objective-c – 在iOS 6中获取当前界面方向

objective-c – 在iOS 6中获取当前界面方向,第1张

概述我在iOS 5.x中动态进行方向检查,如下所示: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ if(interfaceOrientation == UIInterfaceOrientationPortrait||interfaceOrientation = 我在iOS 5.x中动态进行方向检查,如下所示:

-(BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation{ if(interfaceOrIEntation == UIInterfaceOrIEntationPortrait||interfaceOrIEntation ==         UIInterfaceOrIEntationPortraitUpsIDeDown)  {self.vIEwProfile.frame = CGRectMake(238,612,295,73);// some more settings}else{self.profileNew.frame = CGRectMake(374,540,58); // some more settings} return YES;}

对于iOS 6,我做了以下代码,但那不起作用:

-(BOol)shouldautorotate{       return YES;}-(NSInteger)supportedInterfaceOrIEntations{ if (UIDeviceOrIEntationIsPortrait([UIDevice currentDevice].orIEntation))   {   self.vIEwProfile.frame = CGRectMake(238,73);   // some more settings  }  else  {   self.profileNew.frame = CGRectMake(374,58);   // some more settings  } return UIInterfaceOrIEntationMaskAll;}

如何像在iOS 5.x中一样检查iOS 6中的界面内容?

谢谢

解决方法 您可以使用vIEwWillLayoutSubvIEws方法,在该方法中检查方向

[[UIApplication sharedApplication] statusbarOrIEntation];

并相应地设置您的帧.

希望这可以帮助!

总结

以上是内存溢出为你收集整理的objective-c – 在iOS 6中获取当前界面方向全部内容,希望文章能够帮你解决objective-c – 在iOS 6中获取当前界面方向所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1059685.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存