问题描述
|
我试图通过考虑方向来在viewDidLoad中布置一些子视图,
这是我的代码。永远不会执行NSLog。请帮忙。
-(void) viewDidLoad {
[super viewDidLoad];
if ( UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
}
if ( UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
NSLog(@\"This is landscape\");
}
}
解决方法
我认为这是因为视图始终以纵向加载。
编辑:尝试:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
// Your code...
}