Custom change orientation
Categories: iPhone on Jan.12, 2010
Solution for change orientation with uitabbar and others exeptions.
- [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didOrientation:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
And method
- - (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)



Оставить отзыв