从ModalView打开ModalView

时间:2011-04-01 10:16:55

标签: iphone objective-c ipad uisplitviewcontroller modalviewcontroller

我有一个带有客户列表的SplitViewController,在选择客户端之后,我用以下代码打开一个包含其上所有信息的modalView:

detailsForm *detView = [[[detailsForm alloc] setDict:[[self.curClientList objectAtIndex:indexPath.row] attributes]] autorelease];
[detView setModalPresentationStyle:UIModalPresentationPageSheet];
[detView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:detView animated:YES];

然后,该控制器上有一个“编辑”按钮,应该再打开1次模态视图。 按钮事件具有以下代码:

NSLog(@"Edit button clicked");
editNewClient *editView = [[[editNewClient alloc] edit:YES setEditData:self.resultsDict] autorelease];
[editView setModalPresentationStyle:UIModalPresentationPageSheet];
[editView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.splitViewController presentModalViewController:editView animated:YES];

没有任何反应。如果我改变了行

[self.splitViewController presentModalViewController:editView animated:YES];

[self presentModalViewController:editView animated:YES];

我得到一个例外:

-[detailsForm viewControllers]: unrecognized selector sent to instance 0x53882d0

怎么了? 或者我被迫使用代表?

1 个答案:

答案 0 :(得分:2)

presentModalViewController仅在从ViewController使用时才有效。这是一个UIViewController消息。在这种情况下,我不认为你的'自我'是控制者。这就是选择器无法识别它的原因。如果我是你,我会使用代表来做这件事。我希望这会有所帮助。

相关问题