判断设备的状态
UIApplication* app = [UIApplication sharedApplication];
// 判断设备方向状态,做响应的操作
if(app.statusBarOrientation == UIInterfaceOrientationPortrait || app.statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown){
}else if(app.statusBarOrientation == UIInterfaceOrientationLandscapeLeft || app.statusBarOrientation == UIInterfaceOrientationLandscapeRight){
}
设备状态,分以下几种:
以iPhone或者iPad的Home按钮为参照:
UIInterfaceOrientationPortrait---------按钮在下
UIInterfaceOrientationPortraitUpsideDown---------按钮在上
UIInterfaceOrientationLandscapeLeft---------按钮在左
UIInterfaceOrientationLandscapeRight---------按钮在右
程序中,根据的方向不同做不同的操作!
时间: 2024-10-23 18:27:32