Mapkit 具有多注释(callout),映射下一个视图
需要一些帮助来解决我面临的 Mapkit 问题。应该是一个愚蠢的问题,或者我在浏览 Mapkit 框架时错过了一些东西。
这是参议员。 当用户执行某些搜索(如披萨)时,我会在地图上放置多个注释。 添加了右侧注释视图的按钮,单击后将打开下一个详细视图。问题是如何将一些信息发送到下一个视图,例如我在创建注释时向注释添加索引,现在我想从注释访问此信息,并通过按钮上设置的选择器将其传递到下一个视图。
我已经检查了所有精细的地图套件,但没有找到可以将这些信息与下一个视图和注释进行映射的地图套件。
希望我的问题没有让你们感到困惑。请让我知道我会重新设计它。
提前打招呼。
Wanted some help with a problem with mapkit I am facing. Should be a silly problem or I have missed out something while going through the mapkit framework.
Here is the senario.
I am placing multiple annotation on the map when the user performs some search like pizza.
Added button for the right annotation view, on click which opens a next detail view. The problem is how to send some information to the next view, for example I add index to annotations while creating them, now I want to access this information from annotation, and pass it to the next view via the selector set on the button.
I have checked all the mapkit delicate, but don't find a one where I can map this information with the next view and annotation.
Hope I have not confused you guys in my question. Please let me know I will reframe it.
Thaking in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您为注释创建
UIButton
时,请设置tag
属性(标记是UIView
的NSInteger
属性)到标识相关对象的 id 或数组索引。然后,您可以将该标记值从sender
参数检索到选择器。编辑:这是一些示例代码。
您创建注释视图并将按钮关联到委托的 -mapView:viewForAnnotation: method:
}
然后在操作方法中,您将从
tag
中解压值并使用它来显示正确的详细信息:When you create the
UIButton
for the annotation, set thetag
property (tag is anNSInteger
property ofUIView
) to an id or array index that identifies the relevant object. You can then retrieve that tag value from thesender
parameter to your selector.Edit: here's some sample code.
You create your annotation view and associate the button in your delegate's -mapView:viewForAnnotation: method:
}
Then in your action method, you'll unpack the value from
tag
and use it to display the right detail:在注释视图中,是否可以抓取标题或副标题或您在创建图钉时使用的任何其他信息?我想要做的是根据这些变量之一在注释中弹出某个图像。
In the Annotation view, is it possible to grab,say, the Title or Subtitle or any other information you used while creating pins? What i am looking to do is have a certain image popup in the annotation based on one of those variables.
另一种选择:
您可以实现这些方法:
Another option:
You can implement these methods: