Search Results for 'UIDeviceOrientationDidChangeNotification'

ATOM Icon

1 POSTS

  1. 2011/12/28 [iPhone] UIDeviceOrientationDidChangeNotification by incree

[iPhone] UIDeviceOrientationDidChangeNotification

http://stackoverflow.com/questions/1500060/view-controller-not-getting-shouldautorotatetointerfaceorientation-messages-on


- (void)viewWillAppear:(BOOL)animated {
   
[super viewWillAppear:animated];

   
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
   
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
}

-(void) receivedRotate: (NSNotification *) notification {
   
DebugLog(@"ORIENTATION CHANGE");

   
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];

       
if(interfaceOrientation == UIDeviceOrientationPortrait) {
               
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(0));
               
self.view.bounds = CGRectMake(0, 0, 320, 480);
       
}
       
else if(interfaceOrientation == UIDeviceOrientationLandscapeLeft) {
               
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
               
self.view.bounds = CGRectMake(0, 0, 480, 320);
       
}
       
else if(interfaceOrientation == UIDeviceOrientationLandscapeRight) {
               
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90));
               
self.view.bounds = CGRectMake(0, 0, 480, 320);
       
}
}

Posted by incree

2011/12/28 23:57 2011/12/28 23:57
,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/84

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다


Notices

Archives

Authors

  1. incree

Recent Trackbacks

Calendar

«   2017/12   »
          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            

Site Stats

Total hits:
436147
Today:
3
Yesterday:
155