【发布时间】:2015-01-03 16:44:05
【问题描述】:
尝试根据设备旋转后的屏幕边界更改多个标签和图像宽度。这是我尝试过的:
- (void)viewDidLayoutSubviews{
if( UIInterfaceOrientationIsLandscape( [[UIDevice currentDevice] orientation] )) {
CGSize newSize;
newSize = CGSizeMake([[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height);
NSLog(@"%@",NSStringFromCGSize(newSize));
}else if (UIInterfaceOrientationIsPortrait( [[UIDevice currentDevice] orientation] )){
CGSize newSize;
newSize = CGSizeMake([[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height);
NSLog(@"%@",NSStringFromCGSize(newSize));
}
}
当我改变方向时它应该记录不同的宽度和高度
(就像在 iphone5 上一样:{480,320} 和 {320,480})
在ios8 上工作正常, 但我在ios7 模拟器和ios7 设备上进行了相同大小的测试。
任何想法都将不胜感激。
【问题讨论】:
标签: iphone5 ios8 ios7 ios7 ios ios7 ios8 screen-orientation detect