1. Change addSubview to setRootViewController.
[Window addSubview: viewController. view]; modify as follows:
If ([[UIDevice currentDevice]. systemVersion floatValue] <6.0)
{
// Warning: addSubView doesn' t work on iOS6
[Window addSubview: viewController. view];
}
Else
{
// Use this mehod on ios6
[Window setRootViewController: viewController];
}
2. Modify shouldAutorotateToInterfaceOrientation
-(BOOL) shouldAutorotateToInterfaceOrientation :( UIInterfaceOrientation) interfaceOrientation
{
Return UIInterfaceOrientationIsLandscape (interfaceOrientation );
}
IOS6 used to call this method to determine whether the mobile phone is vertical or horizontal.
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead of shouldAutorotateToInterfaceOrientation
-(NSUInteger) supportedInterfaceOrientations {
Return UIInterfaceOrientationMaskLandscape;
}
-(BOOL) shouldAutorotate {
Return YES;
}
The above method must be added to iOS6.