You are doing it right. Try to change the registration, you will see the difference.
In another way, there should be something else in your code that prevents the view from changing.
EDIT: I was completely wrong. Try the following:
Create instance variable
BOOL _mapNeedsPadding;
and initialize it to NO;
Then set the mapView delegate to yourself and add it to the class header
Then add this to your class
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{ if(_mapNeedsPadding){ _mapNeedsPadding = NO; [self.mapView setVisibleMapRect:self.mapView.visibleMapRect edgePadding:UIEdgeInsetsMake(100, 20, 10, 10) animated:YES]; } }
Finally, call the showAnnotations function as follows:
_mapNeedsPadding = YES; [self.mapView showAnnotations:annotations animated:YES];
The showAnnimation function will call the regionDidChangeAnimated function. You need to set _mapNeedsPadding to NO after changing visibleMapRect, because this function (setVisibleMapRect: self) also triggers regionDidChangeAnimated.
Hope this helps!
The Windwaker Feb 26 '14 at 13:30 2014-02-26 13:30
source share