mapkit

Searching a TableView of annotations

情到浓时终转凉″ 提交于 2019-12-04 18:31:42
I had no idea how to set up a database when i started so i have 80 annotations that all look like this workingCoordinate.latitude = 50.795825; workingCoordinate.longitude = -1.103139; MainViewAnnotation *Levant = [[MainViewAnnotation alloc] initWithCoordinate:workingCoordinate]; [Levant setTitle:@"Levant"]; [Levant setSubtitle:@"Unit R09, Gunwharf Quays"]; [Levant setAnnotationType:MainViewAnnotationTypePortsmouth]; [mapView addAnnotation:Levant]; They are grouped into 22 cities through the MainViewAnnotationType, which is coded as follows: - (NSInteger)numberOfSectionsInTableView:(UITableView

MapView: Use MKUserTrackingBarButtonItem to toggle map tracking state

旧巷老猫 提交于 2019-12-04 18:22:05
I have added a MKUserTrackingBarButtonItem to my toolbar. But, clicking it does nothing. So, I assumed I need to use addTarget like a normal UIBarButtonItem but that doesn't work either. How can I attach a method to that button so that I can change setUserTrackingMode:animated: ? MKUserTrackingBarButtonItem *trackingItem = [[[MKUserTrackingBarButtonItem alloc] initWithMapView:mapView] autorelease]; UISegmentedControl *segmentedControl = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"List", @"Detail", nil]] autorelease]; segmentedControl.frame = CGRectMake(0, 0, 220, 30)

In xcode 9 with iOS 11 - issue with loading of Map tiles on first run

爷,独闯天下 提交于 2019-12-04 18:14:46
问题 --Updated with new findings -- Tested in both simulator and on device. Maps are not loaded correctly when the app is run from a cold start. Tiles are not being displayed. mapViewDidFinishLoadingMap is not being called. So something is going wrong for the map not to finish, but I am getting no errors. The map is loaded fine if I just briefly go out of the app and then in again. Meaning that the maps are loaded if app is opened from background. Any ideas what has change? Worked just fine in iOS

Polyline not drawing from user location (blue dot)

南笙酒味 提交于 2019-12-04 18:08:30
- (void)viewDidLoad { [super viewDidLoad]; CLLocationCoordinate2D currentLocation; currentLocation.latitude = self.mapView.userLocation.location.coordinate.latitude; currentLocation.longitude = self.mapView.userLocation.location.coordinate.longitude; CLLocationCoordinate2D otherLocation; otherLocation.latitude = [lati doubleValue]; otherLocation.longitude = [longi doubleValue]; MKPointAnnotation *mka = [[MKPointAnnotation alloc]init]; mka.Coordinate = otherLocation; mka.title = @"!"; [self.mapView addAnnotation:mka]; self.mapView.delegate = self; MKMapPoint *pointsArray = malloc(sizeof

mapkit show annotation by default

血红的双手。 提交于 2019-12-04 17:18:52
问题 I have an annotation showing in mapkit with a custom image, showing fine, but the annotation shows after taping the pin, how can I have the annotation showing by default?, when I start the view? whit out tapping the pin. - (MKAnnotationView *)mapView:(MKMapView *)mv viewForAnnotation:(id <MKAnnotation>)annotation { if([annotation isKindOfClass:[MKUserLocation class]]) return nil; NSString *annotationIdentifier = @"PinViewAnnotation"; MKPinAnnotationView *pinView = (MKPinAnnotationView *)

MapKit update annotation image

女生的网名这么多〃 提交于 2019-12-04 17:17:06
I'm having a problem finding out the way to update a custom MKAnnotationView image after a asynchronous request completes with information about the status of the annotation. So far, I have this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"EstacionEB"; if ([annotation isKindOfClass:[EstacionEB class]]) { EstacionEB *location = (EstacionEB *) annotation; CustomPin *annotationView = (CustomPin *) [_mapita dequeueReusableAnnotationViewWithIdentifier:identifier]; if (annotationView == nil) { annotationView = [

-[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] error

拟墨画扇 提交于 2019-12-04 17:15:07
问题 This is my code, showing both the alert and the blue dot for the current position on the map: MapName.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import <CoreLocation/CoreLocation.h> @interface MapName : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> @property (strong, nonatomic) IBOutlet MKMapView *MapName; @property (strong, nonatomic) CLLocationManager *locationManager; @end MapName.m - (void)viewDidLoad { [super viewDidLoad]; self.locationManager = [

iOS SDK: MapKit MKPolyLine not showing

╄→гoц情女王★ 提交于 2019-12-04 16:47:44
I'm trying to display a polyline on my map, but the line doesn't show up. I tried a lot of things, but noting seems to work. I checked the Core Data functions, and it is returning data, so that is not the problem. It must me somewhere in the mappoint creation or the dwawing on the map (I guess). I'm sure it must be a little mistake somewhere, but I can't find it. My code: - (void)viewDidLoad { [super viewDidLoad]; AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; mapView.delegate = self; } - (void)createLine { AppDelegate *appDelegate = [[UIApplication sharedApplication]

Enabling and Disabling Annotation Dragging (On The Fly) (iOS Mapkit)

倖福魔咒の 提交于 2019-12-04 16:44:26
I've created a mapview which has a button to switch between an 'edit' mode and a 'drag' mode based on the project requirements. I realize that it's easy enough to have your annotations draggable from creation by setting them draggable in the viewForAnnotation, but the behavior required won't allow this. I've tried a couple different ways of changing the annotations to draggable without success. The first thought was to loop through the existing annotations and set each one to 'draggable' and 'selected', but I get an unrecognized selector sent to instance error (I did try instantiating a new

iPhone MapKit - update annotations coordinates and map

旧时模样 提交于 2019-12-04 16:24:28
I use this tutorial for integrating MapKit to my application: http://iphonebcit.wordpress.com/iphone-map-kit-tutorial/ CLLocationCoordinate2D coordinate; coordinate.latitude = 49.2802; coordinate.longitude = -123.1182; NSUInteger count = 1; for(int i = 0; i < 10; i++) { CGFloat latDelta = rand()*.035/RAND_MAX - .02; CGFloat longDelta = rand()*.03/RAND_MAX - .015; CLLocationCoordinate2D newCoord = {coordinate.latitude+latDelta, coordinate.longitude+longDelta}; MapDemoAnnotation* annotation = [[MapDemoAnnotation alloc] initWithCoordinate:newCoord andID:count++]; [mapView addAnnotation:annotation