[英]iOS Mapkit - SetRegion error
Could you point me what is wrong with this code? 您能指出我这段代码有什么问题吗?
-(void) showStoreRegion:(NSInteger)idx
{
//StoreLocation* store = [self.listStore objectAtIndex:idx];
//self.coordinate = CLLocationCoordinate2DMake(store.latitude,store.longitude);
self.coordinate = CLLocationCoordinate2DMake(10.7500,106.6667);
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta = 0.001;
span.longitudeDelta = 0.001;
region.span = span;
region.center = self.coordinate;
[theMapView setRegion:region animated:TRUE];
[theMapView regionThatFits:region];
[self addAnns];
}
I got this message "terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Region ' " when run this code/ 运行此代码时,我收到此消息“由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'无效区域'“
You haven't initialised your region propertly. 您尚未正确初始化您的区域。 Try this 尝试这个
MKCoordinateSpan span = MKCoordinateSpanMake(0.001,0.001);
MKCoordinateRegion region = MKCoordinateRegionMake(self.coordinate, span)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.