两个方法都是用ViewController是建立在UINavigationController之上的
er:animated
例如:
TestViewController *testViewController = [[TestViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewControll er: testViewController];
[self.window addSubview:nav.view];
UINavigationController是导航控制器,如果pushViewController的话,会跳转到下一个ViewController,点返回按钮会回到现在这个ViewController,推出试图push,下一页面会自动添加返回按钮
例如:
UserPushViewController *pViewController
= [[UserPushViewController alloc] init];
[self.navigationController
上推一个试图,下一页没有返回按钮,需要自己添加
NewDataViewController
UINavigationController
[self.navigationController
[baNewViewController
[baNavigation
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:@"返回"style:UIBarButtonItemStyleDone target:self action:@selector(returnView)];
返回方法
- (void)returnView
{
}