的MKMapView不正确转换 [英] MKMapView not transitioning properly
问题描述
我有一个作为的MKMapView名为 MAINVIEW
另一个的UIView子视图。如果我我的过渡 MAINVIEW
在y轴带:
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];
那么 MAINVIEW
和它所有的子视图很好100点,向下转换屏幕除了的MKMapView,它保持完全在原来的位置。
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.
于是,我就另一项实验中,也感动 frame.origin.y
中的MKMapView,然后实际的移动地图视图,而不是与其他意见的同步(它有轻微的延迟)。
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).
任何一个想法,这是为什么?我认为,因为的MKMapView不是直接的UIView
子类。有没有办法来解决这个问题?
Anyone an idea why that is? I assume because MKMapView is not a direct UIView
subclass. Is there a way to fix this behavior?
推荐答案
固定。问题是父的 autoresizesSubviews
属性的UIView
这是默认设置为是
,并导致与的MKMapView $ C一个奇怪的行为$ C>。设置
autoresizesSubviews
到 NO
使得它像一个魅力的工作: - )
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 :-)
这篇关于的MKMapView不正确转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!