Le SDK Maps pour iOS v3.10.0 (bêta) introduit les nouvelles fonctionnalités suivantes que vous pouvez essayer :
- Personnalisation de cartes avec les styles de cartes basés dans le cloud
- Personnalisation des polylignes : polylignes à motif
Personnalisation des cartes avec le style de carte 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 sites Web. Pour en savoir plus, consultez la 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 en utilisant GMSTextureStyle
. Les images recouvrent entièrement la ligne, mais sont coupées au niveau des points d'extrémité 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 à l'aide de 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;