UIInterfaceOrientation和状况栏有关,经由过程UIApplication的单例调用statusBarOrientation来获取
- UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
3)监听、处理和移除 界面偏向改变的通知
解释:手机锁定竖屏后,UIApplicationWillChangeStatusBarOrientationNotification和UIApplicationDidChangeStatusBarOrientationNotification通知也掉效了。
3、UIInterfaceOrientationMask
UIInterfaceOrientationMask是为了集成多种UIInterfaceOrientation而定义的类型,和ViewController相干,一共有7种
1)iOS中的UIInterfaceOrientationMask定义
- //以监听UIApplicationDidChangeStatusBarOrientationNotification通知为例
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(handleStatusBarOrientationChange:)
- name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
- //界面偏向改变的处理
- - (void)handleStatusBarOrientationChange: (NSNotification *)notification{
- UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
- switch (interfaceOrientation) {
推荐阅读
近年来,Python 在数据科学行业扮演着越来越重要的角色。是以,我根据比来的应用体验,在本文中列出了对数据科学家、工程师们最有效的那些库。因为这些库都开源了,我们大年夜Github上惹人>>>详细阅读
本文标题:代码处理iOS的横竖屏旋转
地址:http://www.17bianji.com/lsqh/36388.html
1/2 1