我有一段代码用来检测ViewController
,具体是在另一个Navigation Stack中的VC弹出时执行:
- (void) leftViewDidHide{
if ([((AppDelegate *)[UIApplication sharedApplication].delegate).frontViewController.navigationController.viewControllers objectAtIndex:1]) {
SGServerListViewController *sample = [[[((AppDelegate *)[UIApplication sharedApplication].delegate).frontViewController.navigationController.viewControllers objectAtIndex:1]childViewControllers] objectAtIndex:0];
[sample.serverTableView setUserInteractionEnabled:YES];
}
}
然而运行之后程序就会崩溃,异常出在if语句哪行。不知道怎么解决这个问题?我只需要检测是否这个视图控制器在执行代码,谢谢帮忙
补充:
异常是: out of bounds