如何将美国的位置集中在iphone中

时间:2011-08-19 13:19:28

标签: iphone objective-c

如何在地图工具包视图中将我们位置的中心放在地图中

我在这里发送我的代码

mapView .scrollEnabled = YES;
    appDelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
    dataStore = [[DataStore alloc] init];
    utility = [[Utility alloc] init];

    self = [super initWithFrame:CGRectMake(0, 28, mapView.frame.size.width, mapView.frame.size.height)];
    //[self setBackgroundColor:[UIColor whiteColor]];

    [self setMapView:mapView];

    MKCoordinateRegion region;

region.center.latitude = 41.603854;
    region.center.longitude = -92.930628;
    region.span.longitudeDelta = 47.00;
    region.span.latitudeDelta = 10.00;

1 个答案:

答案 0 :(得分:0)

您需要在设置后设置区域。

region.center.latitude = 41.603854;
region.center.longitude = -92.930628;
region.span.longitudeDelta = 47.00;
region.span.latitudeDelta = 10.00;

[mapView setRegion:region animated:YES];