Note that there are some explanatory texts on larger screens.

plurals
  1. POI need help debugging a method in my iPhone app
    primarykey
    data
    text
    <p>I am new to iPhone apps and objective c and I cannot figure out what is wrong with my method the general idea is that it goes to a plist which contain latitudes and longitudes, takes the data stored in the array that the user enters in a text field, and then outputs a pin at that location. Any suggestions would be greatly appreciated. I have only posted the code for the method, but if having any other part of the application would help in debugging my code then I'd be happy to post it.</p> <pre><code>-(IBAction) showBus { [busNum resignFirstResponder]; bus *currentBus = [[bus alloc] init]; NSString *txtFieldData = [[NSString alloc] initWithString: busNum.text]; //get data from plist NSString *myFile = [[NSBundle mainBundle] pathForResource:@"busLocations" ofType:@"plist"]; NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile: myFile]; [myFile release]; [currentBus setLat:[[dictionary objectForKey:txtFieldData] objectAtIndex:0]]; [currentBus setLong:[[dictionary objectForKey:txtFieldData] objectAtIndex:1]]; //[currentBus setName:[[dictionary objectForKey:txtFieldData] objectAtIndex:2]]; [txtFieldData release]; [dictionary release]; int latit = [[currentBus Lat] intValue]; int longit = [[currentBus Long] intValue]; NSLog(@"latitude is %d and longitude is %d",latit,longit); /* [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; */ MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; region.center.latitude = latit; region.center.longitude = longit; region.span.longitudeDelta = 0.01f; region.span.latitudeDelta = 0.01f; [mapView setRegion:region animated:YES]; [mapView setDelegate:self]; DisplayMap *ann = [[DisplayMap alloc] init]; ann.title = @"Bus %@",[currentBus name]; ann.coordinate = region.center; [mapView addAnnotation:ann]; //[ann release]; [currentBus release]; } </code></pre> <p>Thanks for the help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload