Para aplicar diseño al relleno y el trazo de un polígono de límite, usa un cierre de diseño que
acepte un GMSPlaceFeature y devuelva un
GMSFeatureStyle para definir los atributos de diseño. Luego, establece la propiedad style en un cierre de diseño, que contiene la lógica de diseño.
Swift
letoptions=GMSMapViewOptions()options.mapID=GMSMapID(identifier:"YOUR_MAP_ID")options.camera=GMSCameraPosition(latitude:20.773,longitude:-156.01,zoom:12)letmapView=GMSMapView(options:options)letlayer=mapView.featureLayer(of:.locality)// Define a style with purpleletstyle=FeatureStyle(fill:.purple.withAlphaComponent(0.5),stroke:.purple,strokeWidth:3.0)// Apply the style to a single boundary.layer.style={($0.placeID=="ChIJ0zQtYiWsVHkRk8lRoB1RNPo"/* Hana, HI */)?style:nil}
Objective-C
GMSMapViewOptions*options=[[GMSMapViewOptionsalloc]init];options.camera=[GMSCameraPositioncameraWithLatitude:20.773longitude:-156.01zoom:12];options.mapID=[GMSMapIDmapIDWithIdentifier:@"MAP_ID"];GMSMapView*mapView=[[GMSMapViewalloc]initWithOptions:options];GMSFeatureLayer<GMSPlaceFeature*>*layer=[mapViewfeatureLayerOfFeatureType:GMSFeatureTypeLocality];// Define a style with purple fill and border.GMSFeatureStyle*style=[GMSFeatureStylestyleWithFillColor:[[UIColorpurpleColor]colorWithAlphaComponent:0.5]strokeColor:[UIColorpurpleColor]strokeWidth:3.0];// Apply the style to a single boundary.layer.style=^(GMSPlaceFeature*feature){return[feature.placeIDisEqual:@"ChIJ0zQtYiWsVHkRk8lRoB1RNPo"/* Hana, HI */]?style:nil;};
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2026-10-21 (UTC)"],[],[]]