znq
znq

Reputation: 44973

MKMapView not transitioning properly

I've a MKMapView as a child view of another UIView called mainView. If I transition my mainView on the y-axis with:

[UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
    CGRect frame = self.mainView.frame;
    frame.origin.y += 100.0f;
    self.mainView.frame = frame;
} completion:nil];

then the mainView and all it's subviews nicely transition down the screen by 100 points, except of the MKMapView, which stays exactly at the original position.

So I tried another experiment and also moved the frame.origin.y of the MKMapView, which then actual moves the map view, but not synchronized with the other views (it has a slight delay).

Anyone an idea why that is? I assume because MKMapView is not a direct UIView subclass. Is there a way to fix this behavior?

Upvotes: 1

Views: 1161

Answers (1)

znq
znq

Reputation: 44973

Fixed. The problem was the autoresizesSubviews property of the parent UIView which was set to YES by default and causes a strange behavior with the MKMapView. Setting autoresizesSubviews to NO makes it work like a charm :-)

Upvotes: 4

Related Questions