일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 끄니
- creative park
- paper-replika
- 실생묘
- 반려동물
- PassingCars
- 명랑이
- 블루베리
- objective-c
- Wall-E
- 스파르탄
- Blueberry
- cephalotus
- 산책묘
- 끈끈이주걱
- 세팔
- 식충식물
- UIAlertView addSubView
- 고양이 산책
- paper craft
- 아기고양이
- 세팔로투스
- 고양이
- CountDiv
- UIAlertView setFrame
- ios
- 태그를 입력해 주세요.
- 종이모형
- 애완동물
- codility
Archives
- Today
- Total
꼼시월드
ios 기기의 회전 값 구하기 본문
출처 : http://stackoverflow.com/questions/5559652/how-do-i-detect-the-orientation-of-the-device-on-ios
if UIViewController:
if (UIDeviceOrientationIsLandscape(self.interfaceOrientation)) { // }
if UIView:
if (UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) { // }
UIDevice.h:
#define UIDeviceOrientationIsPortrait(orientation) ((orientation) == UIDeviceOrientationPortrait || (orientation) == UIDeviceOrientationPortraitUpsideDown) #define UIDeviceOrientationIsLandscape(orientation) ((orientation) == UIDeviceOrientationLandscapeLeft || (orientation) == UIDeviceOrientationLandscapeRight)
add this code to xxx-Prefix.pch then you can use it anywhere:
// check device orientation #define dDeviceOrientation [[UIDevice currentDevice] orientation] #define isPortrait UIDeviceOrientationIsPortrait(dDeviceOrientation) #define isLandscape UIDeviceOrientationIsLandscape(dDeviceOrientation) #define isFaceUp dDeviceOrientation == UIDeviceOrientationFaceUp ? YES : NO #define isFaceDown dDeviceOrientation == UIDeviceOrientationFaceDown ? YES : NO
usage:
if (isLandscape) { NSLog(@"Landscape"); }
'iOS' 카테고리의 다른 글
UIAlertView addSubView ios7 (0) | 2014.01.29 |
---|---|
중첩된 딕셔너리의 키를 이용하여 정렬하기 (0) | 2014.01.24 |
url scheme을 이용하여 카톡,라인,마이피플 앱 설치 확인하기 (0) | 2013.11.26 |
라인 url scheme (0) | 2013.11.26 |
아코디언 테이블뷰, cell folding sample code (0) | 2013.10.20 |
Comments