English 中文(简体)
ForSegue 系统(ForSegue)
原标题:calloutaccessorycontroltapped or prepareForSegue

我有一个地图,而地图有注释, 我可以在表格视图中看到这些注释作为单元格, 然后我就可以看到任何单元格的细节, 我选择的单元格就像 xcode 中的主细节工程 。

像这样

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
Object *object = [self.objects objectAtIndex:indexPath.row];
DetailsViewController *detailsViewController = segue.destinationViewController;
detailsViewController.detailItem = object;
}

该代码是表格视图中的单元格的代码,该单元格将推动到详细视图中

但我想要当用户按 UI 按钮按钮时, 用户按 UI 按钮Type DetailDisldislation 在注解中, 然后按钮将转到与单元格在表格视图中输入的相同的“ 详细 View 控制器” 。

这样做是可能的吗?

我读过关于TeleoutAccessory Control TATD(调控)的图例, 但我不确定如何作出注释, 被选中为我在“细节查看”中宣布的细节。

谢谢:)

最佳回答

有点不清楚你在问什么。这里有几个猜测和答案:

How do I perform a segue from a map callout accessory button?

从 IB 中的控件( 表格单元格、 按钮等) 拖动是一个很好的表达方式, 因为 UIKit 可以为您处理所有事情 -- -- 当控件被窃听时, 它会自动地自动执行 。 但有些控件您无法从中创建 segues, 或者有时您可能想要用程序来控制 进行 segue 。 为此, 您可以从查看控制器本身 < / em > 中拖动 < em > 来创建一个 segue ; 给 segue 一种独特的标识符, 然后在您的视图控制器中, 您可以调用 < code> [ 自我执行 SegueOnaliter: @ " myIdactor" 每当您想要使用 seguegue 时, 您可以调用 < code> < 。

在此情况下, 您可能会在 < code> mapView: anountationView: forcalloutAccessery controltacted: 中调用这种调用 。

How do I pass my model object to the next view controller in this kind of segue?

假设您的模型天体符合 MKAN注解 协议, 您又用 add ad annotation: 将其添加到地图上。 在这种情况下, 当您的地图代表( 假设您的查看控制器 s) < code> mapView: annotationView: annotationView:ChoalloutAcsocial Control tapped: 方法被调用时, 第二个参数引用了相应的 MKANnountationView 。 该类别具有属性 < code> annotation , 它将指向您的模型对象。

当然,在这种方法中,你刚刚调用了 perperformaxSegueIndentify: ,所以你还没有访问目的地视图控制器。所以现在你需要保持该示范对象引用(例如,在 ivar 中),然后您的 < code> prepareForSegue:seander: 执行可以将其传递到目的视图控制器。

问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签