0

我终于设法修剪我的代码并将所有 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];

}

有什么建议么?

4

1 回答 1

0

加载 NIB 文件时出现问题?没有从 TaskViewController 的 init 方法返回 self?你确定 taskViewController 不为零吗?也许你应该在父导航控制器上调用它?您是否将 UIModalPresentationFullScreen 设置为模态演示样式?

于 2011-03-22T12:46:48.383 回答