解释:竖屏时刻,宽是SCREEN_MIN,高是SCREEN_MAX;横屏时刻,宽是SCREEN_MAX,高是SCREEN_MIN。
3、屏幕扭转下处理Demo
- //监听UIApplicationDidChangeStatusBarOrientationNotification的处理
- - (void)handleStatusBarOrientationChange: (NSNotification *)notification{
- UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
- BOOL isLandscape = NO;
- switch (interfaceOrientation) {
- case UIInterfaceOrientationUnknown:
- NSLog(@"未知偏向");
- break;
- case UIInterfaceOrientationPortrait:
- case UIInterfaceOrientationPortraitUpsideDown:
- isLandscape = NO;
- break;
- case UIInterfaceOrientationLandscapeLeft:
- case UIInterfaceOrientationLandscapeRight:
- isLandscape = YES;
- break;
- default:
- break;
- }
- if (isLandscape) {
- self.tableView.frame = CGRectMake(0, 0, SCREEN_MAX, SCREEN_MIN - 44);
- }else{
- self.tableView.frame = CGRectMake(0, 0, SCREEN_MIN, SCREEN_MAX - 64);
- }
- [self.tableView reloadData];
推荐阅读
近年来,Python 在数据科学行业扮演着越来越重要的角色。是以,我根据比来的应用体验,在本文中列出了对数据科学家、工程师们最有效的那些库。因为这些库都开源了,我们大年夜Github上惹人>>>详细阅读
本文标题:代码处理iOS的横竖屏旋转
地址:http://www.17bianji.com/lsqh/36388.html
1/2 1