Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func mapView(mapView: MKMapView!, regionDidChangeAnimated animated: Bool) {
- dispatch_async(self._queue, {
- if (self.busStops.count > 0) {
- if (mapView.camera!.altitude <= 1000) {
- for (var i = 0; i < self.busStops.count; i++) {
- if (MKMapRectContainsPoint(mapView.visibleMapRect, MKMapPointForCoordinate(self.busStops[i].position))) {
- let stop = BusAnno()
- stop.setCoordinate(self.busStops[i].position)
- stop.type = "stop"
- stop.title = self.busStops[i].name
- stop.subtitle = self.busStops[i].street
- self.activeStops.append(stop)
- }
- }
- dispatch_async(self._queue, {
- self.mapView.addAnnotations(self.activeStops)
- })
- } else if (self.activeStops.count > 0) {
- mapView.removeAnnotations(self.activeStops)
- self.activeStops = []
- }
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement