在mapkit注解当前位置赛格瑞酥料饼无锚赛格瑞 [英] Postion segue popover on mapkit annotation without segue anchor

查看:231
本文介绍了在mapkit注解当前位置赛格瑞酥料饼无锚赛格瑞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用故事板以x code 4.2的项目。我使用的是mapkit框架。我试图通过注释用SEGUE选择的用户来定位酥料饼。

I have a project in xCode 4.2 using storyboards. I'm using the mapkit framework. I'm trying to position a popover by the annotation the user selected with a segue.

下面是我有。

if([view.annotation isKindOfClass:[ContentPoint class]]) {
    NSLog(@"I see this in my log");

    [self performSegueWithIdentifier:@"ViewAudioSegue" sender:mapView.selectedAnnotations];
}

这调用正确的SEGUE,但由于SEGUE具有图形页面的锚,在酥料饼会​​显示在地图上的钮和选择的注释不旁边。我已经尝试了不同的发送者(视图,地图等),但我得到了相同的结果。有没有一种方法以编程方式设置锚?这是错误我得到无需手动设置锚的 * 的终止应用程序由于未捕获的异常'NSInternalInconsistencyException',原因:'UIStoryboardPopoverSegue必须是从栏按钮的项目或视图psented $ P $'

This calls the correct segue, but because the segue has an anchor of mapview, the popover displays at the botton of the map and not beside the selected annotation. I've tried different senders (view, map, etc.) but I get the same result. Is there a way to programmatically set the anchor? This is the error I get without manually setting the anchor "* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIStoryboardPopoverSegue must be presented from a bar button item or a view.'"

推荐答案

您还可以创建你锚酥料饼SEGUE并选定时,它的按钮在注释位置的隐藏按钮。下面是一个使用的tableview类似的解决方案在我回答了一个单独的问题 http://stackoverflow.com/a/14514837/1712892。主要的区别是,你将不得不计算在屏幕上标注的位置和移动anchorButton那里,然后通过你的自定义注解作为发件人当您执行SEGUE。我居然在同一个项目这样做。如果我有时间,我会用实例编辑这个今晚稍后。

You could also create a hidden button that you anchor the popover segue to and position the button over the annotation when it is selected. Here is a similar solution using a tableview in a separate question that I answered http://stackoverflow.com/a/14514837/1712892. The primary difference being that you would have to calculate the position of the annotation on the screen and move the anchorButton there, then pass your custom annotation as the sender when you perform the segue. I am actually doing this in the same project. If I have time I will edit this with examples later tonight.

这篇关于在mapkit注解当前位置赛格瑞酥料饼无锚赛格瑞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆