Unable to pass variables from one view to another

Posted by jerincbus on Stack Overflow See other posts from Stack Overflow or by jerincbus
Published on 2010-04-18T19:07:42Z Indexed on 2010/04/18 19:13 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

I have a detail view that includes three UIButtons, each of which pushes a different view on to the stack. One of the buttons is connected to a MKMapView. When that button is pushed I need to send the latitude and longitude variables from the detail view to the map view. I'm trying to add the string declaration in the IBAction:

- (IBAction)goToMapView {

MapViewController *mapController = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil];

mapController.address = self.address;
mapController.Title = self.Title;
mapController.lat = self.lat;
mapController.lng = self.lng;

//Push the new view on the stack
[[self navigationController] pushViewController:mapController animated:YES];
[mapController release];
mapController = nil;

}

But I get this when I try to build: 'error: incompatible types in assignment' for both lat and lng variables. So my questions are am I going about passing the variables from one view to another the right way? And does the MKMapView accept latitude and longitude as a string or a number?

© Stack Overflow or respective owner

Related posts about mkmapview

Related posts about objective-c