为什么在平移时从未调用regionWillChangeAnimated:?
问题:
我的 MKMapViewDelegate
的 - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
选择器永远不会被调用我在 iPhone 5.0 模拟器中平移地图(但在缩放时调用)。它在 4.3 模拟器和 4.3 设备上正常工作(或者至少我认为应该如此)。我目前无法访问 5.0 设备。
情况:
我有一个 MKMapView 实例(在 Interface Builder 中创建) - 我在 viewWillLoad 中仔细检查了它
- (void)viewDidLoad {
assert(self.myMapView);
[self.stopMapView setDelegate:self];
}
我进一步定义了一些 MKMapViewDelegate
的选择器,但涉及的选择器我是:
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
RKLogDebug(@"Will Change map longSpan: %lf", mapView.region.span.longitudeDelta);
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
RKLogDebug(@"Did Change map longSpan: %lf", mapView.region.span.longitudeDelta);
}
这是怎么回事?在 iPhone 5.0 模拟器上,代理不会以某种方式获悉 MKMapView 中的“平移”。我已经尝试重置模拟器内容但无济于事。我想知道这是否只是一些模拟器错误或 iOS5 的预期行为? (我使用的是 10.7.2 和 Xcode 4.2)。
The problem:
My MKMapViewDelegate
's - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
selector is never called while i pan the map (but is called while zooming) in iPhone 5.0 simulator. It works as it should (or at least i suppose it should) on 4.3 simulator and 4.3 device. I don't have access to 5.0 device at the moment.
Situation:
I have a MKMapView instance (created in Interface Builder) - i double checked it in viewWillLoad
- (void)viewDidLoad {
assert(self.myMapView);
[self.stopMapView setDelegate:self];
}
I further define some of the MKMapViewDelegate
's selectors, but the ones that concern me are:
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
RKLogDebug(@"Will Change map longSpan: %lf", mapView.region.span.longitudeDelta);
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
RKLogDebug(@"Did Change map longSpan: %lf", mapView.region.span.longitudeDelta);
}
What's going on here? The delegate is not somehow informed about the 'panning' in the MKMapView while on iPhone 5.0 Simulator. I already tried to reset simulator content but to no avail. I wonder whether is it just some simulator bug or iOS5's intended behavior? (I'm on 10.7.2 & Xcode 4.2).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将这两种方法添加到我的项目中。
测试的 iPhone 5.0 模拟器:缩放/平移 ->方法被调用
我在 10.7.2 & Xcode 4.2 也是如此。
所以我可以确认这不是你想象的那样的故意行为。
希望有帮助。
I added the two methods to my project.
Tested iPhone 5.0 simulator: zooming / panning -> methods get called
I'm on 10.7.2 & Xcode 4.2 too.
So I can confirm it's not intented behavior as you thought it could be.
Hope it helps.