单击的每一行都会将您带到另一个视图控制器
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if( indexPath.row == 0 ){
titleController = [[TitleFundraiserController alloc] initWithNibName:@"TitleFundraiserController" bundle:nil];
[self.navigationController presentViewController:titleController animated:YES completion:nil];
}
if( indexPath.row == 1 ) {
recipientController = [[RecipientController alloc] initWithNibName:@"RecipientController" bundle:nil];
[self.navigationController presentViewController:recipientController animated:YES completion:nil];
}
if( indexPath.row == 2 ) {
fundController = [[FundingController alloc] initWithNibName:@"FundingController" bundle:nil];
[self.navigationController presentViewController:recipientController animated:YES completion:nil];
}
if( indexPath.row == 3 ) {
locationController = [[LocationController alloc] initWithNibName:@"LocationController" bundle:nil];
[self.navigationController presentViewController:locationController animated:YES completion:nil];
}
}
但是,有时我会从控制台收到此错误,并且我的程序正在崩溃
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'Application tried to present a nil modal view controller on target <UINavigationController: 0x7c7a340>.'
我不知道为什么这么说。
如果您以前遇到过此问题,请提供帮助。
谢谢