Search Results

Search found 152 results on 7 pages for 'mapkit'.

Page 5/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • MKMapView not calling delegate methods

    - by criscokid
    In a UIViewController I add a MKMapView to the view controlled by the controller. - (void)viewDidLoad { [super viewDidLoad]; CGRect rect = CGRectMake(0, 0, 460, 320); map = [[MKMapView alloc] initWithFrame:rect]; map.delegate = self; [self.view addSubview:map]; } Later in the controller I have - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView { NSLog(@"done."); } Done never gets printed. None of the other delegate methods get called either like mapView:viewForAnnotation: I use a MKMapView in an another app, but this seems to happen on any new application I make. Has anyone else seen this behavior? EDIT: The problem seems to be when UIViewController is made the delegate of the MKMapView, a direct subclass of NSObject seems to work okay. I can work around like this, still seems very odd since I've done it before.

    Read the article

  • How do I place another attribute to a MKAnnotation?

    - by kevin Mendoza
    for my app each annotation on a map corresponds to a mine locality. each mine has its own unique 7 digit integer identifier. I'm trying to add the property minesEntryNumber to the annotation so when the annotation is clicked on later I can bring up specific information on the selected annotation. This is part of my code: for (id mine in mines) { //NSLog(@"in the loop"); workingCoordinate.latitude = [[mine latitudeInitial] doubleValue]; workingCoordinate.longitude = [[mine longitudeInitial] doubleValue]; iProspectAnnotation *tempMine = [[iProspectAnnotation alloc] initWithCoordinate:workingCoordinate]; [tempMine setTitle:[mine mineName]]; tempMine.minesEntryNumber = [mine entryNumber]; //other code for dealing with mine types and adding the annotation to the mapview } the code works fine without the "tempMine.minesEntryNumber = [mine entryNumber];" part. It loads the map and shows the annotations. however when I try and put this in it brings up an error. So how do I add this property to each annotation and how do I access it later in a different .m file?

    Read the article

  • MKReverseGeocoder only showing one placemark

    - by Taylor Satula
    Hi, Something is wrong with my code. It is only showing the final placemark when I try to show the Street and City on one line. I don't know what I am doing wrong (a beginner problem most likely). I hope someone can help my out. - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark { [self doLog:[placemark.thoroughfare, placemark.locality description]]; if ([geocoder retainCount]) [geocoder release]; }

    Read the article

  • iPhone current user location coordinates showing as (0,0)

    - by ennuikiller
    I'm trying to get the users current latitude and longitude with this viewDidLoad method. The resulting map is correctly indicating the current location however the NSLog consistently shows: 2009-09-19 16:45:29.765 Mapper[671:207] user latitude = 0.000000 2009-09-19 16:45:29.772 Mapper[671:207] user longitude = 0.000000 Anyone know what I am missing here? Thanks in advance for your help! - (void)viewDidLoad { [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; [mapView setShowsUserLocation:YES]; CLLocation *userLoc = mapView.userLocation.location; CLLocationCoordinate2D userCoordinate = userLoc.coordinate; NSLog(@"user latitude = %f",userCoordinate.latitude); NSLog(@"user longitude = %f",userCoordinate.longitude); }

    Read the article

  • My map callouts don't display the image when clicked

    - by Neelam Khan
    I am developing an iPhone application for a university project and I'm new to iPhone development. I have looked through Apple's MapCallouts code but it doesn't seem feasible to implement it. So far my code displays a map, drops annotations, displays the title and it displays the right call out button. But this is where I encounter problems. When I press on the callout button, it displays a blank view controller but it should display a different image for every callout that's tapped and this isn't happening so far. I have added my code below: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { //NSUInteger tag = ((UIButton *)control).tag; if (self.detailController==nil) { DetailViewController* detailViewController = [[DetailViewController alloc] init]; [self.navigationController pushViewController:detailViewController animated:YES]; } // self.detailController.tag =1; //to identify image required // self.detailController.tag = tag; [self.navigationController pushViewController:detailController animated:YES]; }

    Read the article

  • Storing an subtitle on an annotation with NSUserDefualts

    - by Krismutt
    Hey everybody! Basically: what i try to do is to save the street address of an annotation so that when I quit the application and launch it again the street address still will be there...see the following code: SavePosition.m -(NSString *)subtitle{ if (!subtitle) { return @"Ingen gata i närheten"; } else { return subtitle; } } -(NSString *)title{ return @"Sparad Position"; } -(id)initWithCoordinate:(CLLocationCoordinate2D) coor{ self.coordinate=coor; NSLog(@"%f,%f",coor.latitude,coor.longitude); return self; } - (void)setCoordinate:(CLLocationCoordinate2D)koor { MKReverseGeocoder *geocoder = [[[MKReverseGeocoder alloc] initWithCoordinate:koor] autorelease]; geocoder.delegate = self; coordinate = koor; [geocoder start]; } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { NSLog(@"fail %@", error); } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark { self.subtitle = [placemark.addressDictionary valueForKey:@"Street"]; } -(void)applicationWillTerminate:(UIApplication *)application { NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults]; [userDef setValue:subtitle forKey:@"SavedAddress"]; [userDef setBool:YES forKey:@"Street"]; [userDef synchronize]; } @end mainViewController.m -(void)viewDidLoad { [super viewDidLoad]; NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults]; if ([userDef boolForKey:@"sparadKoordinat-existerar"]) { CLLocationCoordinate2D savedCoordinate; savedCoordinate.latitude = [userDef doubleForKey:@"sparadKoordinat-latitud"]; savedCoordinate.longitude = [userDef doubleForKey:@"sparadKoordinat-longitud"]; SparaPosition *position=[[SparaPosition alloc] initWithCoordinate:savedCoordinate]; [mapView addAnnotation:position]; savedPosition = savedCoordinate; raderaSparad.enabled=YES; skickaMaps.enabled=YES; mStoreLocationButton.enabled=NO; friZoom = NO; NSString *savedAddress = [[NSUserDefaults standardUserDefaults] objectForKey:@"SavedAddress"]; if (savedAddress) { savedAddress.subtitle = [userDef valueForKey:@"Street"]; // what code should I add here? } MKCoordinateRegion region; region.center.latitude = savedCoordinate.latitude; region.center.longitude= savedCoordinate.longitude; MKCoordinateSpan span; span.latitudeDelta = 0.01; span.longitudeDelta = 0.01; region.span = span; region = [mapView regionThatFits:region]; [mapView setRegion:region animated:YES]; [mapView setRegion:region animated:TRUE]; }

    Read the article

  • annotation pins in iphone

    - by alecnash
    Guys I am a little bit stuck here. So here it goes. I am using json to get latitude and longitude for a map project. I use these values to add some pins on the map. I also created a detail view for the pins. Here comes the tricky part. I want to load some images from my db to the detail view but I don't know how to tell the pins appart so the right image goes to the right pin. Thanks in advance

    Read the article

  • iPhone SDK: Track users location using GPS

    - by Nic Hubbard
    I have a few questions about CoreLocation and GPS. First, what method in core location is used to continually get the users current coordinates? And at what interval should these be retrieved? Second, should these coordinates be pushed into a NSMutableArray each time they are received, so that the array of coordinates will represent the users path? Thanks, just wanting to get started getting me mind around this.

    Read the article

  • Display selectedAnnotation info

    - by elife_iPhone
    When I use this: - (void)mapView:(MKMapView *)myMapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { NSLog(@"SelectedAnnotations is %@", myMapView.selectedAnnotations); } It Displays this in the log. "<Annotation: 0x586cdb0>" Now this is a weird question, but how do I get the info from this Annotation? I have lost my mind. This is what is in the annotation. myAnnotation = [[Annotation alloc] init]; myAnnotation.dealName=[NSString stringWithFormat:@"%@",[tempValue objectForKey:@"name"]]; myAnnotation.subName=[NSString stringWithFormat:@"Price: $%@",[tempValue objectForKey:@"price"]]; myAnnotation.latitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLatitude"] doubleValue]]; myAnnotation.longitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLongitude"] doubleValue]]; myAnnotation.dealId = [NSNumber numberWithInt:[ [tempValue objectForKey:@"dId"] intValue ]]; Thanks for your help.

    Read the article

  • Can I use Google Maps API (Places API) in my iPhone app to find locations near me?

    - by Mark
    I have a couple of questions regarding using Google maps API, especially the Places API in my iPhone application. Can I use Places API in my iPhone app and still release the app as a paid app? Could I release my app as free if I am unable to use these APIs in a paid app? Is there an example for figuring out store locations around user's current location using Places API? For example if the user types "Groceries" in the app, I would like to show all the Store that sell groceries near the user's location. Thanks!

    Read the article

  • multiple regionDidChangeAnimated calls - what gives?

    - by mvexel
    I have a MKMapView inside a UITableView as a custom cell (don't ask ;) - don't know if it matters really), for which I register a regionDidChangeAnimated delegate method. This method gets called three times when the UITableView is loaded - once with the actual region and then two more times with a region that is way off. In the simulator, I consistently get a region with center (+37.43997405, -97.03125000). On the device, it seems to depend on the location reported by the location manager, which initializes the map view. Why am I getting three regionDidChangeAnimated calls? And why are the center coordinates for the last two of them off? This is the code I use to get the center coordinates: - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated { CLLocation *l = [[CLLocation alloc] initWithLatitude:self.mapView.centerCoordinate.latitude longitude:self.mapView.centerCoordinate.longitude]; (....)

    Read the article

  • create CLLocationCoordinate2D from array

    - by shani
    I have a plist with dictionary of array's with coordinates (stored as strings). I want to create a CLLocationCoordinate2D from every array and crate an overlay for the map. I did that - NSString *thePath = [[NSBundle mainBundle] pathForResource:@"Roots" ofType:@"plist"]; NSDictionary *pointsDic = [[NSDictionary alloc] initWithContentsOfFile:thePath]; NSArray *pointsArray = [NSArray arrayWithArray:[pointsDic objectForKey:@"roade1"]]; CLLocationCoordinate2D pointsToUse[256]; for(int i = 0; i < 256; i++) { CGPoint p = CGPointFromString([pointsArray objectAtIndex:i]); pointsToUse[i] = CLLocationCoordinate2DMake(p.x,p.y); NSLog(@"coord %f",pointsToUse [i].longitude); NSLog(@"coord %f",pointsToUse [i].latitude); } MKPolyline *myPolyline = [MKPolyline polylineWithCoordinates:pointsToUse count:256]; [[self mv] addOverlay:myPolyline]; but the app is crashing without any error. (BTW when i remove the addOverLay method the app does not crash). I have 2 questions- What am i doing wrong? I have tried to set the pointsArray count as the argument for the CLLocationCoordinate2D like that - CLLocationCoordinate2D pointsToUse[pointsArray count]; And i am getting an error. How can i set the CLLocationCoordinate2D dynamically ? Thanks for any help. Shani

    Read the article

  • MKPinAnnotationView - hard to drag

    - by James Zaghini
    I have a MKPinAnnotationView that the user can drag around the map. It is very difficult for a user to drag the pin. I've tried increasing the frame size and also using a giant custom image. But nothing seems to actually change the hit area for the drag to be larger than default. Consequently, I have to attempt to tap/drag about ten times before anything happens. MKPinAnnotationView *annView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"bluedot"] autorelease]; UIImage *image = [UIImage imageNamed:@"blue_dot.png"]; annView.image = image; annView.draggable = YES; annView.selected = YES; return annView; What am I missing here?

    Read the article

  • MKMapView maptype not changing!

    - by TheLearner
    I cannot understand why my MKMapView does not want to change to satellite view. This method is called and case 1 is called I have stepped over it but it simply does not change to satellite type it always changes to standard. It only works when it goes back to Map type. Anyone have any ideas? - (IBAction)mapSatelliteSegmentControlTapped:(UISegmentedControl *)sender { switch (sender.selectedSegmentIndex) { case 1: //Satellite self.mapView.mapType = MKMapTypeSatellite; default: //Map self.mapView.mapType = MKMapTypeStandard; } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >