ios6.0之后的屏幕旋转: 之前6.0之前的方法是- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return toInterfaceOrientation == UIInterfaceOrientationLandscapeRight ;
{
return toInterfaceOrientation == UIInterfaceOrientationLandscapeRight ;
}
但是ios6.0之后就不支持了,不过要实现两个方法:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
//这里要注意的是不要用了UIInterfaceOrientationLandscapeRight,这个属性不支持,由于我的大意搞了很久才发现了
return UIInterfaceOrientationMaskLandscapeRight;
}
现在运行,屏幕就会向右旋转了..
Application windows are expected to have a root view controller at the end of application launch 运行项目的时候出现了这个提示:
解决办法是: self.window.rootViewController = navigation;
不能用 [self.window addSubview:navigation.view] 这个方法了.