【发布时间】:2010-04-18 19:07:42
【问题描述】:
我有一个包含三个 UIButton 的详细视图,每个 UIButton 都将不同的视图推送到堆栈上。其中一个按钮连接到 MKMapView。当按下该按钮时,我需要将纬度和经度变量从详细视图发送到地图视图。我正在尝试在 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;
}
但是当我尝试构建时,我得到了这个:'错误:分配中不兼容的类型'对于 lat 和 lng 变量。所以我的问题是我是否要以正确的方式将变量从一个视图传递到另一个视图? MKMapView 接受纬度和经度作为字符串还是数字?
【问题讨论】:
标签: iphone objective-c uibutton mkmapview