从 UITableViewController 调用 modalTransitionStyle - 没有任何反应
我最终设法修剪我的代码并将所有 TableViewController-Methods 放在一个单独的类中(远离我的 ViewController)。我有很多问题已经解决了,但有一个问题让我困惑。
当表中发生选择时,我之前加载了一个 modalViewController,效果很好。但现在,当我将所有表方法放在一个单独的类中时,模式视图根本无法加载。当我选择表中的一行时,它调用该函数并很好地逐步执行该函数,但我的 iPhone 屏幕上没有加载视图?!
这是代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
TaskViewController *taskViewController = [[TaskViewController alloc] initWithNibName:@"TaskViewController"
bundle:nil
task:[listOfEntries objectAtIndex:indexPath.row]];
taskViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:taskViewController animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
有什么建议吗?
I finally managed to trim my code and put all the TableViewController-Methods in a separate class (away from my ViewController). I had many problems which I already solved but there is one that puzzles me.
When a selection in the table occurs, I previously loaded a modalViewController, which worked fine. But now, as I put all the Table-methods in a separate class, the modal view simply does not load. It calls the function, and steps through it nicely when I select a row in the table, but there is no view loaded on the screen of my iPhone?!
Here is the code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
TaskViewController *taskViewController = [[TaskViewController alloc] initWithNibName:@"TaskViewController"
bundle:nil
task:[listOfEntries objectAtIndex:indexPath.row]];
taskViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:taskViewController animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
加载 NIB 文件时出现问题?没有从 TaskViewController 的 init 方法返回 self ?你确定taskViewController不是nil吗?也许你应该在父导航控制器上调用它?您是否将 UIModalPresentationFullScreen 设置为模式演示样式?
Problems loading the NIB file? Not returning self from TaskViewController's init method? Are you sure taskViewController is not nil? Maybe you should call this on a parent navigationController? Are you setting UIModalPresentationFullScreen as the modal presentation style?