SecondViewController有个label控件
- (IBAction)click:(id)sender {
//SecondViewController 有个label控件
SecondViewController *vc = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:vc animated:YES];
NSLog(@"%@",vc.label);//1
NSLog(@"view%@",vc.view);//2
NSLog(@"sdf%@", vc.label);//3
}
第1种情况输出
nil
调用顺序为NSlog->viewDidLoad
第2、3种情况正常输出 调用顺序为viewDidLoad->NSLog2->NSLog3
Ps:就写这么多吧