BGLogin * login = [[BGLogin alloc]init];
[nav pushViewController:login animated:YES];
login.view; //access it once to trigger didload
NSAssert(login.navigationItem==login.navigationItemAtDidload,@"They should be the same");//View didload isn't called yet here.
NSAssert(login.navigationController == nav,@"The navigation controller should be the same");
NSAssert(nav.navigationBar.topItem==login.navigationItem,@"We just push our self so our stuff should be on top");
这是简单的代码。但是,如果我不做 login.view 那么 viewDidLoad 将不会首先被调用。如果我做 login.view ,我会收到一个警告,即未使用 login.view 的值。
所以我该怎么做?