statusBarOrientation设备状态

判断设备的状态

 

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---------按钮在右

 

程序中,根据的方向不同做不同的操作!

 

posted on 2016-01-01 10:07  十一点前要睡觉的小寒  阅读(191)  评论(0编辑  收藏  举报