[iOS] 회전 이벤트 받기 (Detecting rotation to landscape manually)
iOS2012. 5. 31. 15:23
1) 통지 메세지 등록:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(detectOrientation) name:@"UIDeviceOrientationDidChangeNotification" object:nil];2) 통지 이벤트에 대한 처리 함수:
-(void) detectOrientation {
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
[self doLandscapeThings];
} else if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait) {
[self doPortraitThings];
}
}
'iOS' 카테고리의 다른 글
[iOS] 객체가 메시지에 응답할 수 있는지 확인하는 방법 (0) | 2012.08.24 |
---|---|
[iOS] NSTimer에 일지중지와 다시 시작 기능 추가 (0) | 2012.08.24 |
[iOS] iOS5의 UDID 정책 변경에 대한 퀵 리뷰 (iOS5 beta 6 기준) (0) | 2012.05.31 |
[iOS] Cocoa Views Guide (Working with the View Hierarchy) (0) | 2012.05.31 |
[iOS] animateWithDuration: delay: options: animations: completion: 함수 사용 예 (0) | 2011.10.13 |
[iOS] 외부 폰트 사용하기 (0) | 2011.10.12 |
[iOS] UIWebView 에 Bounce 효과 제거 (0) | 2011.10.10 |
[iOS] 동기적으로 동작하는 UIAlertView (Custom UIAlertView) (0) | 2011.09.28 |
[iOS] UIView 흔들기 효과 (0) | 2011.09.28 |
[iOS] In App Purchase 앱에서 구매내역 확인 (0) | 2011.09.20 |