ios单个ViewController屏幕旋转-创新互联

如果需要旋转的ViewController 使用了UINavigationController,对UINavigationController进行如下扩展ios单个ViewControl
ler屏幕旋转
@implementation UINavigationController(shouldAutorotate)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); }
- (BOOL)shouldAutorotate { return self.topViewController.shouldAutorotate; }
- (NSUInteger)supportedInterfaceOrientations { return self.topViewController.supportedInterfaceOrientations; } @end

需要旋转的ViewController设置

在新区等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、成都网站建设 网站设计制作专业公司,公司网站建设,企业网站建设,成都品牌网站建设,成都全网营销推广,外贸网站建设,新区网站建设费用合理。
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}

- (BOOL)shouldAutorotate
{
return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}

其他不需要旋转的 ViewController设置,建议添加BaseViewController统一控制

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationPortrait;
}

分享题目:ios单个ViewController屏幕旋转-创新互联
URL地址:https://www.cdcxhl.com/article2/dhdcoc.html

成都网站建设公司_创新互联,为您提供网站排名品牌网站制作网站营销服务器托管响应式网站微信小程序

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都seo排名网站优化