衝突行為可控管標記在與容器衝突 (重疊) 時的顯示方式 另一個標記
設定標記的衝突行為
如要設定衝突行為,請設定
GMSAdvancedMarker.collisionBehavior
到
下列其中一項:
GMSCollisionBehaviorRequired
(預設):一律顯示標記 無論是哪種衝突,這是預設行為。不影響 顯示是否有任何其他標記或基本地圖標籤。GMSCollisionBehaviorOptionalAndHidesLowerPriority
:僅顯示標記 沒有重疊的情況如果這個類型的兩個標記 重疊,系統會顯示zIndex
較高的素材資源。如果兩者相同zIndex
,顯示直向畫面位置較低的標記。GMSCollisionBehaviorRequiredAndHidesOptional
:一律顯示標記 也可以隱藏GMSCollisionBehaviorOptionalAndHidesLowerPriority
。僅顯示標記 沒有重疊的情況不行GMSCollisionBehaviorRequired
。如果這個類型的兩個標記重疊 系統會顯示zIndex
較高的位址。使用標記時,標記的衝突規則 相同的zIndex
未定義。
Swift
// Defines a marker to always display and hide any marker or label overlay with this marker in the base map marker.collisionBehavior = .requiredAndHidesOptional
Objective-C
// Defines a marker to always display and hide any marker or label overlay with this marker in the base map marker.collisionBehavior = GMSCollisionBehaviorRequiredAndHidesOptional