The Maps SDK for iOS v3.10.0 Beta introduces the following new features for you to try:
- Cloud-Based Map Styling/Maps customization
- Polyline customization: stamped polylines
Cloud-Based Map Styling/Maps customization (beta)
You can now create custom styles, and use tokens to assign them to maps in your apps and websites. For more information, see the see the iOS Maps Customization Overview.
Polyline customization: stamped polylines
You can set the appearance of a polyline to a repeating bitmap texture by using GMSTextureStyle
.
The images cover the line completely, but will be cut off around end points and vertices.
To create a stamped polyline, create a GMSStampStyle
of GMSTextureStyle
.
Then set this property on the shape's options object by using stampStyle
, as shown here:
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;