我想检查iOS设备的版本是否大于3.1.3
我尝试过的东西:
[[UIDevice currentDevice].systemVersion floatValue]
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我只想要一个:
if (version > 3.1.3) { }
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
任何尝试最新iOS 6测试版(版本2或3)的人都有相同的自动旋转体验吗?
我不是使用故事板而是纯粹的导航控件:
self.navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[self.window addSubview:navController.view];
Run Code Online (Sandbox Code Playgroud)
并有:
- (BOOL)shouldAutorotateToInterfaceOrientation: ](UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Run Code Online (Sandbox Code Playgroud)
但IOS根本没有任何支持,适用于所有以前的iOS 3GS/4S和4.3,5.0.5.1模拟器,但iOS 6似乎只是马车
在iOS5中,您可以使用此代码段强制方向:
UIViewController *c = [[UIViewController alloc]init];
[self presentModalViewController:c animated:NO];
[self dismissModalViewControllerAnimated:NO];
[c release];
Run Code Online (Sandbox Code Playgroud)
但是这会在iOS6中导致EXC_BAD_ACCESS.如何在iOS6中强制某个方向?
我在纵向模式下有十多个ViewControllers,但无论设备的方向如何,我都需要在横向模式下强制使用一个.