Develop
2013.11.20 01:00
[ios] iphone SetDeviceOrientation 화면 강제 회전
조회 수 18513 댓글 0
iphone에서 화면에 대한 회전을 시키기 위한 간단한 코드는..
[[UIDevice currentDevice] setOrientation:orientation] 이다.
하지만, 이 코드는 non-public API 사용으로 인한 리젝 사유가 되므로 사용할 수 없기 때문에 아래와 같이 회전 관련 메서드를 만들어주어야 한다.
//화면 회전 처리
-(void)SetDeviceOrientation:(UIInterfaceOrientation)orientation { //가로보기 강제 if(orientation==UIInterfaceOrientationPortrait) { orientation=UIInterfaceOrientationLandscapeRight; } //세로보기 강제 else if(orientation==UIInterfaceOrientationLandscapeRight) { orientation=UIInterfaceOrientationPortrait; } int radian=0; CGRect viewFrame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f); [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration: 0.2]; if(orientation==UIInterfaceOrientationLandscapeLeft || orientation==UIInterfaceOrientationLandscapeRight) { viewFrame = CGRectMake(0.0f, 0.0f, 480.0f, 320.0f); } if(orientation==UIInterfaceOrientationPortrait) { radian=0; } else if(orientation==UIInterfaceOrientationPortraitUpsideDown) { radian=180; } else if(orientation==UIInterfaceOrientationLandscapeRight) { radian=90; } else if(orientation==UIInterfaceOrientationLandscapeLeft) { radian=270; } //뷰 회전 시키기 CGAffineTransform transform = CGAffineTransformMakeRotation(degreesToRadian(radian)); self.view.transform=transform; self.view.bounds=viewFrame; [UIView commitAnimations]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
445 | Develop | [html] SVG(Scalable Vector Graphics) 간단 정리 | hooni | 2014.02.13 | 8867 |
444 | Develop | [html] 메타태그 사용예.. 은지나 바라~ | hooni | 2003.04.23 | 7254 |
443 | Develop | [html] 캐쉬된 웹페이지 사용하지 않도록 하는 방법 | hooni | 2003.04.23 | 13070 |
442 | Develop | [ios] UIView 계층구조 | hooni | 2015.01.03 | 1224 |
441 | Develop | [ios] @property의 속성 (strong, weak, copy) 사용 경우 | hooni | 2014.08.08 | 1776 |
440 | Develop |
[ios] AES256 알고리즘을 이용해 데이터 암호화/복호화 방법
![]() |
hooni | 2015.07.21 | 4191 |
439 | Develop |
[ios] APNS 샘플 코드..
![]() |
hooni | 2013.06.27 | 0 |
438 | Develop |
[ios] APNS 클라이언트 구현 (pdf)
![]() |
hooni | 2013.06.27 | 15834 |
437 | Develop | [ios] APNS, Remote Push 사용자가 수신을 동의했는지 확인하기 | hooni | 2018.10.19 | 1370 |
436 | Develop | [ios] APNS, Remote Push 수신 시점에서 앱의 3가지 실행 상태 | hooni | 2018.10.19 | 1093 |
435 | Develop |
[ios] APNS에 사용할 인증서 만들기 (KeyChain에 있는 인증서 Export)
![]() |
hooni | 2015.01.03 | 988 |
434 | Develop |
[ios] App States
![]() |
hooni | 2013.07.22 | 13252 |