我在 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, 295, 58);
// some more settings
}
return YES;
}
对于 iOS 6,我做了以下代码,但那不起作用:
-(BOOL)shouldAutorotate{
return YES;
}
-(NSInteger)supportedInterfaceOrientations
{
if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation))
{
self.viewProfile.frame = CGRectMake(238, 612, 295, 73);
// some more settings
}
else
{
self.profileNew.frame = CGRectMake(374, 540, 295, 58);
// some more settings
}
return UIInterfaceOrientationMaskAll;
}
如何像在 iOS 5.x 中一样检查 iOS 6 中的界面方向?
谢谢