Maps SDK for iOS v3.10.0 ベータ版

Maps SDK for iOS v3.10.0 ベータ版では、以下の新機能をお試しいただけます。

  • Cloud ベースのマップのスタイル設定とマップのカスタマイズ
  • ポリラインのカスタマイズ: スタンプ型ポリライン

Cloud ベースのマップのスタイル設定とマップのカスタマイズ(ベータ版)

カスタム スタイルを作成し、トークンを使用してアプリやウェブサイトの地図に割り当てることができるようになりました。詳しくは、iOS のマップのカスタマイズの概要をご覧ください。

ポリラインのカスタマイズ: スタンプ型ポリライン

GMSTextureStyle を使用すると、ポリラインの外観をビットマップ テクスチャの反復パターンに設定できます。画像はラインを完全に覆いますが、終点と頂点の周囲では切り捨てられます。

スタンプ付きポリラインを作成するには、GMSTextureStyleGMSStampStyle を作成します。次に、stampStyle を使用して、シェイプのオプション オブジェクトでこのプロパティを次のように設定します。

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;
      

サンプルを実行する

GitHub の Google サンプル リポジトリには、Navigation SDK for iOS v3.10.0 ベータ版の使用方法を示すサンプルアプリが含まれています。