Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. func mapView(mapView: MKMapView!, regionDidChangeAnimated animated: Bool) {
  2. dispatch_async(self._queue, {
  3. if (self.busStops.count > 0) {
  4. if (mapView.camera!.altitude <= 1000) {
  5. for (var i = 0; i < self.busStops.count; i++) {
  6. if (MKMapRectContainsPoint(mapView.visibleMapRect, MKMapPointForCoordinate(self.busStops[i].position))) {
  7. let stop = BusAnno()
  8. stop.setCoordinate(self.busStops[i].position)
  9. stop.type = "stop"
  10. stop.title = self.busStops[i].name
  11. stop.subtitle = self.busStops[i].street
  12. self.activeStops.append(stop)
  13. }
  14. }
  15. dispatch_async(self._queue, {
  16. self.mapView.addAnnotations(self.activeStops)
  17. })
  18. } else if (self.activeStops.count > 0) {
  19. mapView.removeAnnotations(self.activeStops)
  20. self.activeStops = []
  21. }
  22. }
  23. })
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement