iPhone,iPad横屏竖屏的判断
2016-08-16 21:23
417 查看
1.方法一:当屏幕变化时会自动调用此方法
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
duration:(NSTimeInterval)duration {
if (interfaceOrientation==UIInterfaceOrientationPortrait) {
}else
if (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown){
}else
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft){
}else
if (interfaceOrientation==UIInterfaceOrientationLandscapeRight){
}
}
2.方法二:通过比较宽高判断
if ([UIScreen
mainScreen].bounds.size.width>[UIScreen mainScreen].bounds.size.height)
{
//横屏
}else{
//竖屏
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
duration:(NSTimeInterval)duration {
if (interfaceOrientation==UIInterfaceOrientationPortrait) {
}else
if (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown){
}else
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft){
}else
if (interfaceOrientation==UIInterfaceOrientationLandscapeRight){
}
}
2.方法二:通过比较宽高判断
if ([UIScreen
mainScreen].bounds.size.width>[UIScreen mainScreen].bounds.size.height)
{
//横屏
}else{
//竖屏
}
相关文章推荐
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏的代码
- JQuery 判断IPad、IPhone、Android是横屏还是竖屏(Window.Orientation实现)
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏的代码
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏的代码
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏的代码
- [JS代码]如何判断ipad或者iphone是否为横屏或者竖屏 - portrait或者landscape
- 基于jquery判断ipad、iphone和Android横屏还是竖屏
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏的代码
- 如何判断ipad或者iphone是否为横屏或者竖屏 - portrait或者landsc
- [JS代码]如何判断ipad或者iphone是否为横屏或者竖屏 - portrait或者landscape
- [JS代码]如何判断ipad或者iphone是否为横屏或者竖屏 - portrait或者lan...
- [JS代码]如何判断ipad或者iphone是否为横屏或者竖屏 - portrait或者landscape
- 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 判断为iPhone 还是iPad?
- 判断设备是iphone还是ipad
- 判断iphone ipad 设备上的相机是否可用
- 判断设备iphone还是ipad
- HTML5中判断横屏竖屏
- 判断设备的类型ipad或者iphone,调用自带应用,禁止锁屏,设置icon上的数字