2016-05-01 11 views
-1

基本的なMKAnnoationを使って通常のMKnapationビューを作成したいのですが、私の目的は英国にあり、MKCoordinateSpanは0.05ですが、ビューからMKMapViewを開始したいのですアノテーションをズームインします。MKMapViewを上から来るようにするには

答えて

0
- (void)viewWillAppear:(BOOL)animated { 
    [super viewWillAppear:animated]; 
    /* set here the region from where map will be zooming; */ 
    [self.mapView setRegion:MKCoordinateRegionForMapRect(MKMapRectWorld) animated:NO]; 
} 

- (void)viewDidAppear:(BOOL)animated { 
    [super viewDidAppear:animated]; 
    /* set here your end point of zooming */ 
    CLLocationCoordinate2D zoomLocation; 
    zoomLocation.latitude = 39.281516; 
    zoomLocation.longitude= -76.580806; 

    [self.mapView setCenterCoordinate:zoomLocation animated:YES]; 
    CLLocationDistance locationDistance = [self locationDistance:0.5]; 
    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, locationDistance, locationDistance); 
    [self.mapView setRegion:viewRegion animated:YES]; 
} 

- (CLLocationDistance)locationDistance:(CGFloat)value { 
    return 1609.344 *value; 
} 
関連する問題