본문 바로가기 메뉴 바로가기

권말련의 게임 블로그

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

권말련의 게임 블로그

검색하기 폼
  • 분류 전체보기 (1430) N
    • 로스트아크 (593)
      • 대항해 (126)
      • 모험의 서 (75)
      • 모코코(대륙) (119)
      • 기억의 오르골 (18)
      • 업적 (30)
      • 누크만의 환영석 (10)
    • GTA5 (13)
      • 스토리모드 (11)
      • 온라인모드 (2)
    • 게임 (533) N
      • 엘든링 (151)
      • 아이온2 (34) N
      • 마비노기 모바일 (8)
      • 오버워치2 (23)
      • 할로우 나이트 실크송 (26)
      • 포켓몬고 (26)
      • 팰월드 (21)
      • 디아블로4 (43)
      • 마인크래프트 (4)
      • 몬스터 헌터 와일즈 (1)
      • 오딘 (22)
      • 아이온 클래식 (75)
      • 바람의 나라:연 (24)
      • AFK아레나 (45)
      • 배틀그라운드 (2)
      • RPG게임 (7)
      • 리니지TL (2)
      • 모바일게임 (17)
    • 모바일게임 쿠폰 (8)
    • IT (201)
      • iOS (67)
      • Android (38)
      • PHP + Mysql (7)
      • AWS+Window Server (5)
      • 블로그 (32)
    • 일상 (76)
      • 맛집 (8)
      • 운동 (15)
      • 여행 (4)
      • 리뷰 (9)
  • 방명록




티스토리 뷰

IT/iOS

iOS6 특정뷰 회전 처리

권말련 2014. 2. 4. 09:46
반응형

iOS6 특정뷰 회전 처리


방금 해결한 문제.

특정뷰에서만 모든 방향으로 회전이 지원되게 하는 방법이다.

프로젝트는 이렇다


Xcode5.0

Device Orientation - Potrait

 - Landscape Left

 - Landscape Right


windows based 로 프로젝트 생성하여 AppDelegate에서 NavigationController 생성하여 루트뷰를 VODViewController 설정했다. setRootViewController로 하는것이 중요하다. addSubview로 했을시 회전 함수가 먹히지 않는다.


UIViewController *centerViewController = [[VODViewController alloc] initWithNibName:@"VODViewController" bundle:nil];

                    

                    navigationController = [[UINavigationController alloc] initWithRootViewController:centerViewController];

[self.window setRootViewController:navigationController];


VODViewController 에서는 세로모드만 지원하게 하고 하위뷰인 VODDetatilView에서는 모든방향으로 회전이 가능하도록 한다. 붉은색으로 된 부분을 추가하자. 주석처리된 부분을 적용하면 frame이 깨져서 붉은색 부분으로 적용하였다.


# VODViewController.m

#import "VODViewController.h"

#import "VODDetailView.h"


@implementation UINavigationController (customRotation)


-(BOOL)shouldAutorotate

{

    return [[self.viewControllers lastObject] shouldAutorotate];

}


-(NSUInteger)supportedInterfaceOrientations

{

    return [[self.viewControllers lastObject] supportedInterfaceOrientations];

}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

{

    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];

}

/*

- (BOOL)shouldAutorotate

{

    return [self.topViewController shouldAutorotate];

}


-(NSUInteger)supportedInterfaceOrientations

{

    return [self.topViewController supportedInterfaceOrientations];

}

*/

@end


@interface VODViewController ()


@end


@implementation VODViewController


- (BOOL)shouldAutorotate

{

    return NO;

}


-(NSUInteger)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskAll;

}


@end


검색 키워드 : UINavigationcontroller rotation category


반응형
그리드형
저작자표시 (새창열림)

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

iOS 7 UI Difference between Simulator and real Device  (0) 2014.02.05
navigation bar title color  (0) 2014.02.04
detailView 20pixel bug  (0) 2014.02.04
UITableView selected background color  (0) 2014.02.04
iPhone emoji encoding decoding  (0) 2014.01.28
CopyPNGfile error  (0) 2013.12.05
D-day 구하기  (0) 2013.11.21
NSMutableArray Sort  (0) 2013.11.07
  • 카카오톡 공유하기
  • 네이버 블러그 공유하기
  • 페이스북 공유하기
  • 트위터 공유하기
  • 구글 플러스 공유하기
  • 카카오스토리 공유하기

댓글
반응형
공지사항
최근에 올라온 글

Blog is powered by Tistory / Designed by Tistory

티스토리툴바