Is there a simple way to delete all the annotations on a map without iterating through all the displayed annotations in Objective-c?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- Spring: controller inheritance using @Controller a
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
Swift 2.0 Simple and the best:
Here is the simplest way to do that:
Here's how to remove all annotations except the user location, written out explicitly because I imagine I will come looking for this answer again:
You do not need to save any reference to user location. All that is needed is:
And as long as you have
mapView.showsUserLocation
set toYES
, you will still have user location on the map. Settings this property toYES
basically asks the map view to start updating and fetching user location, to to show it on the map. From theMKMapView.h
comments:Swift 3
Yes, here is how