GMSCollisionBehaviorRequired (Mặc định): Luôn hiển thị điểm đánh dấu bất kể có xảy ra va chạm hay không. Đây là hành vi mặc định. Không ảnh hưởng đến việc có hiển thị bất kỳ điểm đánh dấu hoặc nhãn bản đồ cơ sở nào khác hay không.
GMSCollisionBehaviorOptionalAndHidesLowerPriority: Chỉ hiển thị điểm đánh dấu nếu điểm đó không trùng với các điểm đánh dấu khác. Nếu hai điểm đánh dấu thuộc loại này trùng nhau, thì điểm đánh dấu có zIndex cao hơn sẽ xuất hiện. Nếu có cùng zIndex, thì quảng cáo có vị trí màn hình dọc thấp hơn sẽ được hiển thị.
GMSCollisionBehaviorRequiredAndHidesOptional: Luôn hiển thị điểm đánh dấu bất kể có xảy ra xung đột hay không và ẩn mọi GMSCollisionBehaviorOptionalAndHidesLowerPriority. Chỉ hiển thị điểm đánh dấu nếu điểm đó không trùng với các điểm đánh dấu khác. Không GMSCollisionBehaviorRequired. Nếu hai điểm đánh dấu thuộc loại này trùng nhau, thì điểm đánh dấu có zIndex cao hơn sẽ xuất hiện. Các quy tắc xung đột cho các điểm đánh dấu có cùng zIndex chưa được xác định.
Swift
// Defines a marker to always display and hide any marker or label overlay with this marker in the base mapmarker.collisionBehavior=.requiredAndHidesOptional
Objective-C
// Defines a marker to always display and hide any marker or label overlay with this marker in the base mapmarker.collisionBehavior=GMSCollisionBehaviorRequiredAndHidesOptional
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-16 UTC."],[[["Collision behavior dictates how markers are displayed when they overlap on the map."],["You can configure a marker's collision behavior using the `GMSAdvancedMarker.collisionBehavior` property with three options: `GMSCollisionBehaviorRequired`, `GMSCollisionBehaviorOptionalAndHidesLowerPriority`, and `GMSCollisionBehaviorRequiredAndHidesOptional`."],["`GMSCollisionBehaviorRequired` is the default, always displaying the marker regardless of overlap."],["`GMSCollisionBehaviorOptionalAndHidesLowerPriority` displays the marker only if it doesn't overlap with others, prioritizing higher `zIndex` and lower screen position in case of conflicts."],["`GMSCollisionBehaviorRequiredAndHidesOptional` always displays the marker and hides any with `GMSCollisionBehaviorOptionalAndHidesLowerPriority` behavior."]]],["Collision behavior dictates marker display during overlaps. Options include: `Required` (always visible, default); `OptionalAndHidesLowerPriority` (visible only if no overlap, higher `zIndex` prevails); and `RequiredAndHidesOptional` (always visible, hides `OptionalAndHidesLowerPriority`). `zIndex` determines priority in overlapping markers, with lower vertical screen position breaking ties in specific cases. Setting `collisionBehavior` in code allows customization of display logic. It's recommended to use the same behavior for all advanced markers.\n"]]