MKMapViewDelegate viewForAnnotation 方法
我的 iPhone 上加载了一张地图,其中显示了图钉注释。我通过使用符合 MKAnnotation 协议的对象来设置这些。
现在,注释显示在模拟器上,但奇怪的是,却没有显示在设备上。 仅供参考,我的两台设备都有网络连接,并且设备运行的是 iOS 3.1.3。
有什么建议吗?
编辑
对象是这样的类的实例:
@interface Point : NSObject <MKAnnotation> {
// etc...
然后将它们添加到地图视图控制器中,如下所示:
MyMapViewController *m = [[MyMapViewController alloc] initWithNibName:@"myMap" bundle:nil];
// Set up Point, thisPoint, with location info...
m.point = thisPoint;
注意,我的 viewForAnnotation 方法没有在设备上调用。它IS在模拟器上被调用(即引脚显示在模拟器上)。
I have a map loading up on my iPhone which shows pin annotations. I set these up by having objects which conform to the MKAnnotation protocol.
Now, the annotations show up on the simulator but, rather bizarrely, not on the device.
FYI, I've got network connectivity on both and the device is running iOS 3.1.3.
Any suggestions?
EDIT
Objects are instances of a class like this:
@interface Point : NSObject <MKAnnotation> {
// etc...
then these are added to the Map View Controller like this:
MyMapViewController *m = [[MyMapViewController alloc] initWithNibName:@"myMap" bundle:nil];
// Set up Point, thisPoint, with location info...
m.point = thisPoint;
Note, my viewForAnnotation method is not being called on the device. It IS being called on the simulator (i.e. the pin is shown on the simulator).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许模拟器正在运行不同的版本,或者您根据版本运行不同的代码。
Perhaps the simulator was running a different build or you had different code running based on version.