MKMapView 不允许用户在 Ipod Touch OS 3.1.3 上交互,但在模拟器 3.2 / 4.0 上正常工作
我一直在编码和测试一个使用导航控制器、选项卡栏和表格视图的应用程序,如本教程视频所示:
我还编码了一个显示自定义注释的 MapView 页面。这似乎在我尝试过的每个版本的模拟器中都运行良好。今天早上,我终于在运行 OS 3.1.3 的 Ipod Touch 上运行了该应用程序 - 一切都按预期运行,除了地图似乎根本不允许用户交互。我根本无法点击注释、当前位置或移动和缩放。
我已经完成了地图视图界面生成器中的所有设置,并确保所有“用户交互”、“允许多点触控”框均已选中。这似乎并没有改变任何事情。
非常感谢任何帮助。
Mapview 按如下方式放入视图中:
// Grab the maps view controller ready for loading
MapView *childController = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];
childController.title = @"View on Map";
// Push the new view controller onto the stack
[self.navigationController pushViewController:childController animated:YES];
[childController release];
childController = nil;
我还尝试在模态视图控制器中运行视图,看看会发生什么。显示了视图,但任何交互似乎都不起作用 - 除了底部的一小部分,我将视图本身稍微缩短了一些,以便它适合标签栏上方。这部分似乎在我的视图下面有另一张地图,它确实响应用户交互。所以有一个 1 厘米左右的块确实在移动——不过我的视野似乎在它上面保持静止。
下面的视图似乎没有任何注释或当前用户位置。
I have been coding and testing an app which uses a navigation controller, tab bar and table views together as shown in this tutorial video:
I have also coded a MapView page which shows custom annotations. This seems to work fine in every version of the simulator I have tried it on. This morning I have finally got the app running on my Ipod Touch which runs OS 3.1.3 - everything works as expected except the map does not seem to allow user interaction at all. I cannot tap on annotations, the current location or move and zoom at all.
I have been through all the settings in the Interface Builder for the mapview, and made sure that all the 'User Interaction', 'Allow Multitouch' boxes have been ticked. This doesn't seem to change anything.
Any help greatly appreciated.
The Mapview is put into the view as follows:
// Grab the maps view controller ready for loading
MapView *childController = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];
childController.title = @"View on Map";
// Push the new view controller onto the stack
[self.navigationController pushViewController:childController animated:YES];
[childController release];
childController = nil;
I've also tried running the view in a modal view controller just to see what would happen. The view was shown and any interaction didnt seem to work - with the exception of a small section at the bottom where I made the view itself slightly shorter so it would fit in above the tab bar. This section seems to have another map underneath my view which DOES respond to user interaction. So there is a 1cm or so block which does move - my view seems to stay static on top of it, though.
The view underneath does not appear to have any annotations or the current user location.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我已经解决了这个问题:
在我设置视图并加载注释的 mapview.m 文件中,在 viewDidLoad 函数中,我有以下代码:
其中 mapView
在当前视图之上添加子视图没有想要工作。实际上,将视图设置为带有注释的新更新视图似乎效果很好。但奇怪的是,模拟器可以工作,而设备却不能工作。
希望这对某人有帮助。
Ok I've solved this one:
In the mapview.m file where I set up the view and load the annotations, within the viewDidLoad function I had the following code:
Where mapView is
Adding a subview on top of the current view didn't want to work. Actually setting the view to be the new updated view with annotations seems to work fine. It's still strange that the simulator would work and not the device in the first place though.
Hope this helps someone.