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屏幕旋转-创新互联
标题路径:http://www.hxwzsj.com/article/dhdcoc.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 网站建设公司 响应式网站设计 成都网站设计 成都网站设计 成都网站建设 成都网站制作 网站建设改版 成都网站制作 自适应网站建设 成都网站设计 成都定制网站建设 外贸网站设计方案 企业手机网站建设 成都网站建设公司 企业网站设计 移动手机网站制作 营销型网站建设 网站设计 网站制作公司 成都网站建设 手机网站制作 成都企业网站制作