
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrIEntationsForWindow:(UIWindow *)window{ return UIInterfaceOrIEntationMaskPortrait | UIInterfaceOrIEntationMaskPortraitUpsIDeDown;} 除了一个屏幕外,无论设备如何旋转,如何将视图锁定为纵向模式?
**来自’公司飞溅’视图的方法.再次,应该是这样的工作.
-(NSInteger)supportedInterfaceOrIEntations{ return UIInterfaceOrIEntationMaskLandscapeleft;} **来自所有其他视图的方法,当我不希望它们旋转时,这些视图会旋转出来
-(BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation{ // IOS5 Only returning that it should rotate to potrait return (interfaceOrIEntation == UIDeviceOrIEntationPortrait);}-(BOol)shouldautorotate{ // forcing the rotate IOS6 Only return YES;}-(NSInteger)supportedInterfaceOrIEntations{ // return number or enum IOS6 Only return UIInterfaceOrIEntationMaskPortrait;} 我想也许可能是因为UITabbarController是根控制器而我在VIEwController中呢?这些方法甚至没有开火?
解决方法 将观察者添加到要旋转的视图的vIEwDIDLoad方法,如下所示:[[UIDevice currentDevice] beginGeneratingDeviceOrIEntationNotifications];[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(orIEntationChanged:) @R_404_6889@:UIDeviceOrIEntationDIDChangeNotification object:[UIDevice currentDevice]];
然后根据orIEntationChanged方法中的横向视图设置视图,如下所示:
- (voID) orIEntationChanged:(NSNotification *)note{UIDevice * device = [UIDevice currentDevice];switch(device.orIEntation){ case UIDeviceOrIEntationPortrait: break; case UIDeviceOrIEntationPortraitUpsIDeDown: break; case UIDeviceOrIEntationLandscapeleft: break; case UIDeviceOrIEntationLandscapeRight: break; default: break; };} 总结 以上是内存溢出为你收集整理的iphone – xcode – 如何将视图锁定为纵向模式,但仍允许一个视图旋转?全部内容,希望文章能够帮你解决iphone – xcode – 如何将视图锁定为纵向模式,但仍允许一个视图旋转?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)