Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Pakiet SDK Map na iOS w wersji 3.10.0 Beta wprowadza te nowe funkcje, które możesz wypróbować:
Dostosowywanie mapy za pomocą definiowania stylów map w Google Cloud
Dostosowywanie linii łamanych: stemplowane linie łamane
Dostosowywanie mapy za pomocą definiowania stylów map w Google Cloud (beta)
Możesz teraz tworzyć style niestandardowe i używać tokenów, aby przypisywać je do map w aplikacjach i witrynach. Więcej informacji znajdziesz w artykule Omówienie dostosowywania Map na iOS.
Dostosowywanie linii łamanych: stemplowane linie łamane
Wygląd polilinii możesz ustawić na powtarzającą się teksturę bitmapową, używając
GMSTextureStyle. Obrazy całkowicie pokrywają linię, ale są ucięte w okolicach punktów końcowych i wierzchołków.
Aby utworzyć polilinię z pieczątką, utwórz GMSStampStyle z GMSTextureStyle.
Następnie ustaw tę właściwość w obiekcie opcji kształtu za pomocą stampStyle, jak pokazano poniżej:
Swift
letpath=GMSMutablePath()path.addLatitude(-37.81319,longitude:144.96298)path.addLatitude(-31.95285,longitude:115.85734)letpolyline=GMSPolyline(path:path)letredWithStamp=GMSStrokeStyle.solidColor(.red)letimage=UIImage(named:"imageFromBundleOrAsset")!// Image could be from anywhereredWithStamp.stampStyle=GMSTextureStyle(image:image)letspan=GMSStyleSpan(style:redWithStamp)polyline.spans=[span]polyline.map=mapView
Objective-C
GMSMutablePath*path=[GMSMutablePathpath];[pathaddLatitude:-37.81319longitude:144.96298];[pathaddLatitude:-31.95285longitude:115.85734];GMSPolyline*polyline=[GMSPolylinepolylineWithPath:path];GMSStrokeStyle*redWithStamp=[GMSStrokeStylesolidColor:[UIColorredColor]];UIImage*image=[UIImageimageNamed:@"imageFromBundleOrAsset"];// Image could be from anywhereredWithStamp.stampStyle=[GMSTextureStyletextureStyleWithImage:image];GMSStyleSpan*span=[GMSStyleSpanspanWithStyle:redWithStamp];polyline.spans=@[span];polyline.map=mapView;
[null,null,["Ostatnia aktualizacja: 2025-08-31 UTC."],[[["\u003cp\u003eThe Beta version of the Maps SDK for iOS is being deprecated and will be decommissioned; features accessed through it will be supported in a future SDK version.\u003c/p\u003e\n"],["\u003cp\u003eThis Beta release (v3.10.0) introduces Cloud-Based Map Styling for customizing maps in apps and websites.\u003c/p\u003e\n"],["\u003cp\u003eThis release also includes Polyline Customization, allowing developers to apply repeating bitmap textures to polylines using \u003ccode\u003eGMSTextureStyle\u003c/code\u003e.\u003c/p\u003e\n"]]],["The Beta SDK is deprecated and unavailable for new use. The Maps SDK for iOS v3.10.0 Beta introduces cloud-based map styling, allowing custom style creation and token assignment. It also introduces stamped polyline customization. To create a stamped polyline, a `GMSStampStyle` of `GMSTextureStyle` must be created and applied to the shape's options using `stampStyle`. Code examples in Swift and Objective-C demonstrate setting a repeating bitmap texture on a polyline.\n"],null,["| **Beta SDK deprecation notice:** The Beta version of the SDK is deprecated and scheduled for decommissioning, and it's no longer available for new usage. The features described in this topic are currently accessed via the Beta SDK. A future version of the SDK will provide similar support for these features. See the [release notes](/maps/documentation/ios-sdk/releases#2021-08-18) for more information.\n\n\u003cbr /\u003e\n\nThe Maps SDK for iOS v3.10.0 Beta introduces the following new\nfeatures for you to try:\n\n- Cloud-Based Map Styling map customization\n- Polyline customization: stamped polylines\n\nCloud-Based Map Styling map customization (beta)\n\nYou can now create custom styles, and use tokens to assign them to maps in your\napps and websites. For more information, see the see the\n[iOS Maps Customization Overview](/maps/documentation/ios-sdk/maps-customization-overview).\n\nPolyline customization: stamped polylines\n\nYou can set the appearance of a polyline to a repeating bitmap texture by using\n`GMSTextureStyle`. The images cover the line completely, but are cut off\naround end points and vertices.\n\nTo create a stamped polyline, create a `GMSStampStyle` of `GMSTextureStyle`.\nThen set this property on the shape's options object by using `stampStyle`, as\nshown here:\n\n\nSwift \n\n```swift\nlet path = GMSMutablePath()\npath.addLatitude(-37.81319, longitude: 144.96298)\npath.addLatitude(-31.95285, longitude: 115.85734)\nlet polyline = GMSPolyline(path: path)\nlet redWithStamp = GMSStrokeStyle.solidColor(.red)\n\nlet image = UIImage(named: \"imageFromBundleOrAsset\")! // Image could be from anywhere\nredWithStamp.stampStyle = GMSTextureStyle(image: image)\n\nlet span = GMSStyleSpan(style: redWithStamp)\npolyline.spans = [span]\npolyline.map = mapView\n \n```\n\nObjective-C \n\n```objective-c\nGMSMutablePath *path = [GMSMutablePath path];\n[path addLatitude:-37.81319 longitude:144.96298];\n[path addLatitude:-31.95285 longitude:115.85734];\nGMSPolyline *polyline = [GMSPolyline polylineWithPath:path];\nGMSStrokeStyle *redWithStamp = [GMSStrokeStyle solidColor:[UIColor redColor]];\n\nUIImage *image = [UIImage imageNamed:@\"imageFromBundleOrAsset\"]; // Image could be from anywhere\nredWithStamp.stampStyle = [GMSTextureStyle textureStyleWithImage:image];\n\nGMSStyleSpan *span = [GMSStyleSpan spanWithStyle:redWithStamp];\npolyline.spans = @[span];\npolyline.map = mapView;\n \n```\n\n\u003cbr /\u003e"]]