La version bêta 3.10.0 du SDK Maps pour iOS introduit les nouvelles fonctionnalités suivantes :
- Personnalisation de cartes avec les styles de cartes basés dans le cloud
- Personnalisation des polylignes : polylignes à motif
Personnalisation de cartes avec les styles de cartes basés dans le cloud (bêta)
Vous pouvez désormais créer des styles personnalisés et utiliser des jetons pour les attribuer à des cartes dans vos applications et sur vos sites Web. Pour en savoir plus, consultez Présentation de la personnalisation des cartes iOS.
Personnalisation des polylignes : polylignes à motif
Vous pouvez créer une polyligne recouverte d'une texture de bitmaps qui se répètent à l'aide de GMSTextureStyle. Les images couvrent complètement la ligne, mais sont coupées au niveau des points de terminaison et des sommets.
Pour créer une polyligne à motif, créez un GMSStampStyle de GMSTextureStyle.
Définissez ensuite cette propriété sur l'objet d'options de la forme en utilisant stampStyle, comme illustré ici :
Swift
let path = GMSMutablePath() path.addLatitude(-37.81319, longitude: 144.96298) path.addLatitude(-31.95285, longitude: 115.85734) let polyline = GMSPolyline(path: path) let redWithStamp = GMSStrokeStyle.solidColor(.red) let image = UIImage(named: "imageFromBundleOrAsset")! // Image could be from anywhere redWithStamp.stampStyle = GMSTextureStyle(image: image) let span = GMSStyleSpan(style: redWithStamp) polyline.spans = [span] polyline.map = mapView
Objective-C
GMSMutablePath *path = [GMSMutablePath path]; [path addLatitude:-37.81319 longitude:144.96298]; [path addLatitude:-31.95285 longitude:115.85734]; GMSPolyline *polyline = [GMSPolyline polylineWithPath:path]; GMSStrokeStyle *redWithStamp = [GMSStrokeStyle solidColor:[UIColor redColor]]; UIImage *image = [UIImage imageNamed:@"imageFromBundleOrAsset"]; // Image could be from anywhere redWithStamp.stampStyle = [GMSTextureStyle textureStyleWithImage:image]; GMSStyleSpan *span = [GMSStyleSpan spanWithStyle:redWithStamp]; polyline.spans = @[span]; polyline.map = mapView;