我尝试检查当前呈现的 View Controller 的 UIInterfaceOrientation,但出于某种原因,它总是返回横向。
UIInterfaceOrientation currentOrientation = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
if (currentOrientation == UIInterfaceOrientationPortrait){
self.scrollView_.colMargin = 50;
} else {
self.scrollView_.colMargin = 130;
}
知道为什么吗?
最佳答案
您可以按如下方式检查方向:
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
if( orientation == UIDeviceOrientationPortrait ) ...
关于iphone - UIViewController 的 UIInterfaceOrientation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11349557/