Custom change orientation
Categories: iPhone on Jan.12, 2010
Solution for change orientation with uitabbar and others exeptions.
1 2 | [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didOrientation:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; |
And method
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - (void) didOrientation: (id)object { UIInterfaceOrientation interfaceOrientation = [[object object] orientation]; if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { self.view.transform = CGAffineTransformMakeRotation(0); } else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight ){ self.view.transform = CGAffineTransformMakeRotation(M_PI * .5); } else { self.view.transform = CGAffineTransformMakeRotation(M_PI * -.5); } } |
Similar posts:

(1 votes, average: 4.00 out of 5)
Оставить отзыв