View rotation methods for iOS5 and iOS6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#pragma mark - View rotation methods // iOS5 support - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Support portrait only orientation for iPhone iOS5 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ // The device is an iPad return YES; }else{ // The device is an iPhone or iPod touch return (interfaceOrientation == UIInterfaceOrientationPortrait | interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown); } } // Disable autorotation for iPhone iOS6 and enable autorotation for iPad iOS6 // iOS6 support -(BOOL)shouldAutorotate { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ // The device is an iPad return YES; }else{ // The device is an iPhone or iPod touch return NO; } } // Support portrait only orientation for iPhone iOS6 and all orientations for iPad iOS6 // iOS6 support -(NSUInteger)supportedInterfaceOrientations { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ // The device is an iPad return (UIInterfaceOrientationMaskAll); }else{ // The device is an iPhone or iPod touch return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); } } |