GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSStyleSpans
Returns an NSArray
of GMSStyleSpan
constructed by repeated application of style and length
information from styles
and lengths
along path
.
path
the path along which the output spans are computed.
styles
an NSArray
of GMSStrokeStyle. Wraps if consumed. Can’t be empty.
lengths
an NSArray
of NSNumber; each entry gives the length of the corresponding
style from styles
. Wraps if consumed. Can’t be empty.
lengthKind
the interpretation of values from lengths
(geodesic, rhumb or projected).
Example: a polyline with alternating black and white spans:
GMSMutablePath
*path;
NSArray
*styles = @[[GMSStrokeStyle
solidColor:[UIColor whiteColor]],
[GMSStrokeStyle
solidColor:[UIColor blackColor]]];
NSArray
*lengths = @[@100000, @50000];
polyline.path = path;
polyline.spans = GMSStyleSpans
(path, styles, lengths, kGMSLengthRhumb);
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSStyleSpans\u003c/code\u003e creates an array of style spans for a given path using styles and lengths.\u003c/p\u003e\n"],["\u003cp\u003eIt applies styles and lengths repeatedly along the path, wrapping around if necessary.\u003c/p\u003e\n"],["\u003cp\u003eStyles are defined by \u003ccode\u003eGMSStrokeStyle\u003c/code\u003e and lengths determine the extent of each style.\u003c/p\u003e\n"],["\u003cp\u003eLengths can be interpreted as geodesic, rhumb, or projected distances.\u003c/p\u003e\n"],["\u003cp\u003eThe example shows how to create a polyline with alternating black and white spans.\u003c/p\u003e\n"]]],["`GMSStyleSpans` creates an array of `GMSStyleSpan` objects based on a given path, styles, and lengths. It takes a `GMSPath`, an array of `GMSStrokeStyle`, an array of `NSNumber` for lengths, and a `GMSLengthKind`. The function applies the styles and corresponding lengths repeatedly along the path. Both `styles` and `lengths` arrays cannot be empty and will wrap if their elements are consumed. `lengths` values indicate the length of the corresponding style and their interpretation depends on `lengthKind`.\n"],null,["# GoogleNavigation Framework Reference\n\nGMSStyleSpans\n=============\n\n extern NSArray\u003c../Classes/GMSStyleSpan.html *\u003e *_Nonnull GMSStyleSpans(\n ../Classes/GMSPath.html *_Nonnull path, NSArray\u003c../Classes/GMSStrokeStyle.html *\u003e *_Nonnull styles,\n NSArray\u003cNSNumber *\u003e *_Nonnull lengths, ../Enums/GMSLengthKind.html lengthKind)\n\nReturns an `NSArray` of [GMSStyleSpan](../Classes/GMSStyleSpan.html) constructed by repeated application of style and length\ninformation from `styles` and `lengths` along `path`.\n\n`path` the path along which the output spans are computed.\n`styles` an `NSArray` of GMSStrokeStyle. Wraps if consumed. Can't be empty.\n`lengths` an `NSArray` of NSNumber; each entry gives the length of the corresponding\nstyle from `styles`. Wraps if consumed. Can't be empty.\n`lengthKind` the interpretation of values from `lengths` (geodesic, rhumb or projected).\n\nExample: a polyline with alternating black and white spans:\n\n\u003cbr /\u003e\n\n ../Classes/GMSMutablePath.html *path;\n NSArray *styles = @[[../Classes/GMSStrokeStyle.html solidColor:[UIColor whiteColor]],\n [../Classes/GMSStrokeStyle.html solidColor:[UIColor blackColor]]];\n NSArray *lengths = @[@100000, @50000];\n polyline.path = path;\n polyline.spans = GMSStyleSpans(path, styles, lengths, kGMSLengthRhumb);\n \n\u003cbr /\u003e"]]