新建一个子类继承 WMPageController
.M关键代码文件如下
#pragma mark 解决适配iOS 8.x 系统横屏问题
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
// if(IOS9Later) return;
UIInterfaceOrientation interfaceOrientation=[[UIApplication sharedApplication] statusBarOrientation];
if (interfaceOrientation == UIDeviceOrientationPortrait || interfaceOrientation == UIDeviceOrientationPortraitUpsideDown) {
//翻转为竖屏时
[self setVerticalFrame];
}else if (interfaceOrientation==UIDeviceOrientationLandscapeLeft || interfaceOrientation == UIDeviceOrientationLandscapeRight) {
//翻转为横屏时
[self setHorizontalFrame];
}
}
//这里的frame size根据值项目中的大小来自定义
-(void)setVerticalFrame
{
///竖屏
self.viewFrame = CGRectMake(0, 64,ScreenWidth ,ScreenHeight-64);
}
-(void)setHorizontalFrame
{
///横屏
self.viewFrame = CGRectMake(0, 32,ScreenWidth , ScreenWidth-320);
}