با استفاده از Maps SDK برای iOS، میتوانید نحوه تعامل کاربران با نقشه خود را با تعیین اینکه کدام یک از اجزای رابط کاربری داخلی روی نقشه ظاهر میشوند و کدام حرکات مجاز هستند، سفارشی کنید.
کنترل های نقشه
Maps SDK برای iOS برخی از کنترلهای UI داخلی را ارائه میکند که مشابه موارد موجود در Google Maps برای برنامه iOS هستند. با استفاده از کلاس GMSUISettings میتوانید قابلیت مشاهده این کنترلها را تغییر دهید. تغییرات ایجاد شده در این کلاس بلافاصله روی نقشه منعکس می شود.
قطب نما
Maps SDK برای iOS یک گرافیک قطب نما را ارائه می دهد که تحت شرایط خاص در گوشه سمت راست بالای نقشه ظاهر می شود. قطب نما فقط زمانی ظاهر می شود که دوربین به گونه ای باشد که دارای یک یاتاقان غیر صفر باشد. هنگامی که کاربر روی قطب نما کلیک می کند، دوربین به موقعیتی با تحمل صفر (جهت پیش فرض) متحرک می شود و پس از مدت کوتاهی قطب نما محو می شود.
قطب نما به طور پیش فرض غیرفعال است. میتوانید با تنظیم ویژگی compassButton در GMSUISettings روی YES ، قطبنما را فعال کنید. با این حال، نمی توانید قطب نما را مجبور کنید همیشه نشان داده شود.
دکمه موقعیت مکانی من تنها زمانی در گوشه سمت راست پایین صفحه ظاهر می شود که دکمه موقعیت مکانی من فعال باشد. هنگامی که کاربر روی دکمه کلیک می کند، دوربین متحرک می شود تا در صورت مشخص بودن مکان کاربر، روی مکان فعلی کاربر تمرکز کند. میتوانید با تنظیم ویژگی myLocationButton در GMSUISettings روی YES ، دکمه را فعال کنید.
سویفت
mapView.settings.myLocationButton=true
هدف-C
mapView.settings.myLocationButton=YES;
کفگیر
هر زمان که یک نقشه داخلی به طور برجسته نشان داده شود، کنترل انتخابگر طبقه در نزدیکی سمت راست پایین صفحه ظاهر می شود. هنگامی که دو یا چند نقشه داخلی قابل مشاهده است، انتخابگر طبقه به نزدیکترین ساختمان به مرکز صفحه مربوط می شود. هر ساختمان دارای یک طبقه پیش فرض است که زمانی که انتخاب کننده برای اولین بار نمایش داده می شود، انتخاب می شود. شما می توانید با انتخاب طبقه متفاوت از انتخاب کننده، طبقه دیگری را انتخاب کنید.
میتوانید با تنظیم ویژگی indoorPickerGMSUISettings روی NO ، کنترل طبقهگیر را غیرفعال کنید.
سویفت
mapView.settings.indoorPicker=false
هدف-C
mapView.settings.indoorPicker=NO;
حرکات نقشه
میتوانید با تنظیم ویژگیهای کلاس GMSUISettings ، که به عنوان ویژگی GMSMapView در دسترس است، حرکات پیشفرض روی نقشه را غیرفعال کنید. ژست های زیر را می توان به صورت برنامه ریزی فعال و غیرفعال کرد. توجه داشته باشید که غیرفعال کردن ژست دسترسی برنامهریزی شده به تنظیمات دوربین را محدود نمیکند.
scrollGestures - فعال یا غیرفعال بودن حرکات اسکرول را کنترل می کند. در صورت فعال بودن، کاربران میتوانند انگشت خود را برای حرکت به دوربین بکشند.
zoomGestures - فعال یا غیرفعال بودن حرکات زوم را کنترل می کند. در صورت فعال بودن، کاربران میتوانند برای بزرگنمایی دوربین، دو بار ضربه بزنند، دو انگشت ضربه بزنند یا نیشگون بگیرند. توجه داشته باشید که وقتی scrollGestures فعال است، دوبار ضربه زدن یا نیشگون گرفتن آن ممکن است دوربین را تا نقطه مشخص شده حرکت دهد.
tiltGestures - فعال یا غیرفعال بودن حرکات شیب را کنترل می کند. اگر فعال باشد، کاربران میتوانند از یک تند کشیدن دو انگشتی عمودی به پایین یا بالا برای کج کردن دوربین استفاده کنند.
rotateGestures - فعال یا غیرفعال بودن حرکات چرخشی را کنترل می کند. در صورت فعال بودن، کاربران می توانند از حرکت چرخش دو انگشتی برای چرخاندن دوربین استفاده کنند.
در مثال زیر، هر دو حرکت حرکت و زوم غیرفعال شده است.
تاریخ آخرین بهروزرسانی 2025-07-23 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-23 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThis documentation outlines how to customize user interaction with the Google Maps SDK for iOS, focusing on controlling built-in UI components and map gestures.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can enable or disable UI controls like the compass, My Location button, and floor picker using the \u003ccode\u003eGMSUISettings\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eMap gestures such as scrolling, zooming, tilting, and rotating can be individually enabled or disabled through properties of the \u003ccode\u003eGMSUISettings\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eDisabling a gesture does not restrict programmatic access to camera settings, only user interaction.\u003c/p\u003e\n"],["\u003cp\u003eThese customizations provide developers with flexibility to tailor the map experience within their iOS applications.\u003c/p\u003e\n"]]],["The Maps SDK for iOS allows customization of user interaction with the map via the `GMSUISettings` class. Built-in UI controls, like the compass, My Location button, and floor picker, can be toggled on or off. The compass is enabled by setting `compassButton` to `YES`, the My Location button with `myLocationButton = YES`, and the floor picker is disabled by `indoorPicker = NO`. Map gestures (scroll, zoom, tilt, rotate) can be enabled or disabled by setting the properties of the same name to `YES` or `NO` respectively.\n"],null,["\u003cbr /\u003e\n\nSelect platform: [Android](/maps/documentation/android-sdk/controls \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/controls \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/controls \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nUsing the Maps SDK for iOS, you can customize the way in which users\ninteract with your map, by determining which of the built in UI components\nappear on the map and which gestures are allowed.\n\nMap controls\n\nThe Maps SDK for iOS provides some built-in UI controls that are\nsimilar to those found in the Google Maps for iOS application. You can\ntoggle the visibility of these controls using the `GMSUISettings` class.\nChanges made on this class are immediately reflected on the map.\n| **Note:** Each control has a predetermined position relative to the edge of the map. You can move the controls away from the edges by [padding](/maps/documentation/ios-sdk/map#map_padding) the map.\n\nCompass \n\nThe Maps SDK for iOS provides a compass graphic which appears in the\ntop right corner of the map under certain circumstances. The compass will only\nappear when the camera is oriented such that it has a non-zero bearing. When the\nuser clicks on the compass, the camera animates back to a position with bearing\nof zero (the default orientation) and the compass fades away shortly afterwards.\n\nThe compass is disabled by default. You can enable the compass by setting the\n`compassButton` property of `GMSUISettings` to `YES`. However, you cannot\nforce the compass to always be shown.\n\n\nSwift \n\n```swift\nlet camera = GMSCameraPosition(latitude: 37.757815, longitude: -122.50764, zoom: 12)\nlet mapView = GMSMapView(frame: .zero, camera: camera)\nmapView.settings.compassButton = true\n \n```\n\nObjective-C \n\n```objective-c\nGMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.757815\n longitude:-122.50764\n zoom:12];\nGMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];\nmapView.settings.compassButton = YES;\n \n```\n\n\u003cbr /\u003e\n\nMy Location button \n\nThe My Location button appears in the bottom right corner of the screen *only*\nwhen the My Location button is enabled. When a user clicks the button, the\ncamera animates to focus on the user's current location if the user's location\nis known. You can enable the button by setting the\n`myLocationButton` property of `GMSUISettings` to `YES`.\n\n\nSwift \n\n```swift\nmapView.settings.myLocationButton = true\n \n```\n\nObjective-C \n\n```objective-c\nmapView.settings.myLocationButton = YES;\n \n```\n\n\u003cbr /\u003e\n\nFloor picker \n\nThe floor picker control appears near the bottom right of the screen whenever an\nindoor map is featured prominently. When two or more indoor maps are visible the\nfloor picker relates to the building nearest to the center of the screen. Each\nbuilding has a default floor which is selected when the picker is first\ndisplayed. You can choose a different floor by selecting it from the picker.\n\nYou can disable the floor picker control by setting the `indoorPicker` property\nof `GMSUISettings` to `NO`.\n\n\nSwift \n\n```swift\nmapView.settings.indoorPicker = false\n \n```\n\nObjective-C \n\n```objective-c\nmapView.settings.indoorPicker = NO;\n \n```\n\n\u003cbr /\u003e\n\nMap gestures\n\nYou can disable the default gestures on the map by setting properties of the\n`GMSUISettings` class, which is available as a property of the `GMSMapView`.\nThe following gestures can be enabled and disabled programmatically. Note that\ndisabling the gesture won't limit programmatic access to the camera\nsettings.\n\n- `scrollGestures` --- controls whether scroll gestures are enabled or disabled. If enabled, users may swipe to pan the camera.\n- `zoomGestures` --- controls whether zoom gestures are enabled or disabled. If enabled, users may double tap, two-finger tap, or pinch to zoom the camera. Note that double tapping or pinching when `scrollGestures` are enabled may pan the camera to the specified point.\n- `tiltGestures` --- controls whether tilt gestures are enabled or disabled. If enabled, users may use a two-finger vertical down or up swipe to tilt the camera.\n- `rotateGestures` --- controls whether rotate gestures are enabled or disabled. If enabled, users may use a two-finger rotate gesture to rotate the camera.\n\nIn the example below, both pan and zoom gestures have been disabled.\n\n\nSwift \n\n```swift\noverride func loadView() {\n let camera = GMSCameraPosition.camera(\n withLatitude: 1.285,\n longitude: 103.848,\n zoom: 12\n )\n\n let mapView = GMSMapView.map(withFrame: .zero, camera: camera)\n mapView.settings.scrollGestures = false\n mapView.settings.zoomGestures = false\n self.view = mapView\n}\n \n```\n\nObjective-C \n\n```objective-c\n- (void)loadView {\n GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285\n longitude:103.848\n zoom:12];\n GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];\n mapView.settings.scrollGestures = NO;\n mapView.settings.zoomGestures = NO;\n self.view = mapView;\n}\n \n```\n\n\u003cbr /\u003e"]]