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