一般情况下不能push是因为当前控制器没有导航控制器,造成不能push的情况.

解决方法如下:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSLog(@"点击left-%d",(int)indexPath.row);
NSLog(@"%@",self.navigationController);
TempViewController *tempVc = [[TempViewController alloc]init];
UINavigationController *navVC = [UIApplication sharedApplication].keyWindow.rootViewController.childViewControllers[].navigationController;
[navVC pushViewController:tempVc animated:YES];
}

还有什么好的解决方式,请大神告知哟..嘻嘻~~~

05-19 08:51