viewDidLoad、viewWillAppear执行顺序

2019-08-13  本文已影响0人  寂寞先森666

viewController 里面

- (void)viewDidLoad {
    [super viewDidLoad];
    secondViewController * secondVC  = [[secondViewController alloc]init];
    NSLog(@"准备push");//不push后面的都不发生
    [self.navigationController pushViewController:secondVC animated:YES];
}

secondViewController 里面

@implementation secondViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"viewDidLoad");
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    NSLog(@"viewWillAppear");
}

2019-08-13 15:54:56.614057+0800 yyModel测试[92403:6058217] 准备push
2019-08-13 15:54:56.647362+0800 yyModel测试[92403:6058217] viewDidLoad
2019-08-13 15:54:56.647614+0800 yyModel测试[92403:6058217] viewWillAppear

上一篇下一篇

猜你喜欢

热点阅读