티스토리 뷰

Mobile/iOS

[iOS]화면 회전 제어하기

out of coding 2016. 3. 22. 16:55

iOS장비의 화면중에 회전을 제어하여야 하는 화면이 있으면 다음과 같이 설정하여서 개발하도록 합니다.

방법은 쉽고, UIViewController에 넣어주면 된다.


(Objective-C 코드)


- (UIInterfaceOrientationMask)supportedInterfaceOrientations {

return UIInterfaceOrientationMaskPortrait;

}


* 옵션

UIInterfaceOrientationMaskPortrait : 세로 화면만 허용

UIInterfaceOrientationMaskAll : 전체 화면 허용

UIInterfaceOrientationMaskPortraitUpsideDown : 거꾸로만 허용

UIInterfaceOrientationMaskLandscape : 가로화면만 허용


(Swift 코드)

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

        return UIInterfaceOrientationMask.Portrait

}


* 옵션

UIInterfaceOrientationMask.Portrait : 세로 화면만 허용

UIInterfaceOrientationMask.All : 전체 화면 허용

UIInterfaceOrientationMask.PortraitUpsideDown : 거꾸로만 허용

UIInterfaceOrientationMask.Landscape : 가로화면만 허용

'Mobile > iOS' 카테고리의 다른 글

[iOS]개발시 버전에 따른 포함 여부 지정  (0) 2016.03.24
[iOS]아이폰 인코딩  (0) 2016.03.23
[iOS]ViewController의 Life Cycle delegate  (0) 2016.03.17
[iOS]Volume 조절  (0) 2016.03.17
[iOS]LocalNotification  (0) 2016.03.10
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/02   »
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
글 보관함