2014-09-01 3 views
2

étant un nouveau développeur IOS, j'ai vraiment du mal à obtenir quelque chose de basique à travailler.Fenêtre d'information personnalisée dans IOS google maps sdk

J'ai besoin d'afficher ce type de fenêtre d'informations personnalisées lors d'un clic sur le marqueur dans google maps sdk pour ios.

enter image description here

Toute aide serait appréciée.

J'ai déjà vu les composants tiers, mais même avec eux, je n'arrive pas à afficher cela. Il y a toujours un titre, un extrait, une image de gauche et une partie d'image de droite. La vraie question est comment obtenez-vous la note d'étoile d'or dans la fenêtre, avec le texte à côté de lui.

+0

plz vérifier ces liens, il peut vous https://github.com/grgcombs/MultiRowCalloutAnnotationView ou https: // github.com/jpsim/JPSThumbnailAnnotation – sbrsantanu

+0

J'ai déjà vu ces liens, ils sont pour mapkit, la clé ici est l'utilisation de google maps – gerhard

+0

http://kevinxh.github.io/swift/custom-and-interactive-googlemaps-ios -sdk-infowindow.html ce blog explique comment résoudre ce problème. –

Répondre

2

Faire Xib que vous voulez ... Définir le texte et l'image

délégué set GMSMapViewDelegate

-(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker{ 

    CustomInfoWindow *infoWindow=[[[NSBundle mainBundle] loadNibNamed:@"InfoWindow" owner:self options:nil] objectAtIndex:0]; 
    return infoWindow; 

} 

https://www.youtube.com/watch?v=ILiBXYscsyY pour plus d'aide voir ce video..Uploded par google

4

Je souffrais du même problème de personnalisation de la fenêtre d'information dans GoogleMapsSdk pour iOS pour beaucoup de jours, est devenu frustré & l'a fait moi-même!

Propre, complètement personnalisable & UIControls propres avec votre code d'actions personnalisées sont disponibles sur Github Right here

Bonne programmation :)

+0

FYI, le rendu en direct de la prise en charge de la fenêtre d'informations a été ajouté dans Google Maps SDK pour iOS V 2+ (à partir de cette version). –

0

Swift 3.0 Solution

Google Map CustomInfoWindow

//empty the default infowindow 
    func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? { 
     return UIView() 
    } 

    // reset custom infowindow whenever marker is tapped 
    func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool { 

     customInfoView.removeFromSuperview() 
    // customInfoView.button.addTarget(self, action: #selector(buttonTapped(_:)), for: .touchUpInside) 
     self.view.addSubview(customInfoView) 

     // Remember to return false 
     // so marker event is still handled by delegate 
     return false 
    } 

    // let the custom infowindow follows the camera 
    func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) { 
     if (locationMarker != nil){ 
      let location = locationMarker.position 
      customInfoView.center = mapView.projection.point(for: location) 
     } 
    } 

    // take care of the close event 
    func mapView(_ mapView: GMSMapView, didTapAt coordinate: CLLocationCoordinate2D) { 
     customInfoView.removeFromSuperview() 
    } 
+0

J'ai l'idée à partir de ce lien http://kevinxh.github.io/swift/custom-and-interactive-googlemaps-ios-sdk-infowindow.html –

Questions connexes