এই উদাহরণটি GMSFeatureTypeLocality জন্য মানচিত্রের সীমানা দেখায় এবং প্রতিনিধি ফাংশন প্রয়োগ করে যা ক্লিক করা বহুভুজকে শৈলী করে। ফলাফল ইভেন্ট ডেটা সহ একটি তথ্য সতর্কতা উইন্ডো প্রদর্শন করে।
এই উদাহরণটি GMSFeatureTypeLocality জন্য মানচিত্রের সীমানা দেখায় এবং প্রতিনিধি ফাংশন প্রয়োগ করে যা ক্লিক করা বহুভুজকে শৈলী করে। ফলাফল ইভেন্ট ডেটা সহ একটি তথ্য সতর্কতা উইন্ডো প্রদর্শন করে।
[null,null,["2025-08-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThis documentation demonstrates handling click events on map boundaries, specifically using \u003ccode\u003eGMSFeatureTypeLocality\u003c/code\u003e for the example.\u003c/p\u003e\n"],["\u003cp\u003eWhen a boundary is clicked, an info window appears displaying event data, such as the place IDs of the clicked features.\u003c/p\u003e\n"],["\u003cp\u003eIt's crucial to note that map boundaries need a minimum alpha value for click events to register, ensuring they are tappable.\u003c/p\u003e\n"],["\u003cp\u003eSample code snippets in Swift and Objective-C are provided for implementation guidance on setting up and responding to click events on map boundaries.\u003c/p\u003e\n"]]],["The content demonstrates handling map boundary click events for the `GMSFeatureTypeLocality` feature on iOS. Key actions include setting a style for locality features (orange with 50% opacity fill, orange stroke, width of 2) and implementing a delegate function. This function triggers an alert showing the `placeID` of the features that are clicked. The code examples are shown in both Swift and Objective-C. Note that a minimal alpha value is required for the polygon features to be tappable.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/dds-boundaries/handle-events \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/dds-boundaries/handle-events \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/dds-boundaries/handle-events \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nThis example shows map boundaries for\n[`GMSFeatureTypeLocality`](/maps/documentation/ios-sdk/reference/objc/Constants/GMSFeatureTypeLocality), and implements the\n[delegate](/maps/documentation/ios-sdk/events) function that styles the clicked\npolygon. The result displays an info alert window with the event data.\n\n**Important:** Invisible features don't trigger click events. Polygons must have a minimal alpha value to make them tappable. \n\nSwift \n\n```swift\nclass SampleViewController: UIViewController {\n\n private lazy var mapView: GMSMapView = GMSMapView(frame: .zero, mapID: GMSMapID(identifier: \"YOUR_MAP_ID\"), camera: GMSCameraPosition(latitude: 40, longitude: -80, zoom: 12))\n\n override func loadView() {\n view = mapView\n let style = FeatureStyle(fill: .orange.withAlphaComponent(0.5), stroke: .orange, strokeWidth: 2)\n mapView.featureLayer(of: .locality).style = { _ in style }\n mapView.delegate = self\n }\n}\n\nextension SampleViewController: GMSMapViewDelegate {\n func mapView(_ mapView: GMSMapView, didTap features: [Feature], in featureLayer: FeatureLayer\u003cFeature\u003e, atLocation: CLLocationCoordinate2D) {\n let toast = UIAlertController(title: \"Clicked places\", message: (features.compactMap { ($0 as? PlaceFeature)?.placeID }).joined(separator: \", \"), preferredStyle: .alert)\n present(toast, animated: true, completion: nil)\n }\n}\n```\n\nObjective-C \n\n```objective-c\n@interface SampleViewController: UIViewController \u003cGMSMapViewDelegate\u003e\n@end\n\n@implementation SampleViewController\n- (void)loadView {\n GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero mapID:[GMSMapID mapIDWithIdentifier:@\"YOUR_MAP_ID\"] camera:[GMSCameraPosition cameraWithLatitude:40 longitude:-80 zoom:12]];\n mapView.delegete = self;\n\n GMSFeatureStyle *style = [GMSFeatureStyle styleWithFillColor:[[UIColor orangeColor] colorWithAlphaComponent:0.5] strokeColor:[UIColor orangeColor] strokeWidth:2.0];\n [mapView featureLayerOfFeatureType:GMSFeatureTypeLocality].style = ^(GMSPlaceFeature *feature) { return style; };\n\n self.view = mapView;\n}\n\n- (void)mapView:(GMSMapView *)mapView didTapFeatures:(NSArray\u003cid\u003cGMSFeature\u003e\u003e *)features inFeatureLayer:(GMSFeatureLayer *)featureLayer atLocation:(CLLocationCoordinate2D)location {\n NSMutableArray\u003cNSString *\u003e *places = [NSMutableArray array];\n\n for (id\u003cGMSFeature\u003e feature in features) {\n if (![feature isKindOfClass:[GMSPlaceFeature class]]) { continue; }\n NSString *placeID = ((GMSPlaceFeature *)feature).placeID;\n [places addObject:placeID];\n }\n\n UIAlertController *toast = [UIAlertController alertControllerWithTitle:@\"Clicked places\" message:[places componentsJoinedByString:@\", \"] preferredStyle:UIAlertControllerStyleAlert];\n [self presentViewController:toast animated:YES completion:nil];\n}\n```"]]