![](/img/trans.png)
[英]How to make annotation point draggable in MapKit using swift 2 and xcode 7?
[英]How do I implement code to make an annotation in MapKit draggable in Swift for iOS?
根據本文檔https://developer.apple.com/documentation/mapkit/mkannotationview/1452401-isdraggable如果將注釋設置為可拖動,則還必須實現setCoordinate。
根據此文檔,如果我實現setCoordinate,則必須https://developer.apple.com/documentation/mapkit/mkannotation/1429528-setcoordinate ,必須以遵守鍵值觀察的方式進行。
你們有經驗嗎? 您能告訴我這是怎么做的嗎? 如何使setCoordinate鍵值觀察符合標准? 我正在使用Swift for iOS。
我從https://forums.developer.apple.com/message/286897?et=watches.email.thread#286897發現,我可以將@objc關鍵字添加到類聲明中,並將@objc和“ dynamic”添加到屬性“坐標”,並且我的Swift代碼成為遵守鍵值觀察的標准。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.