iOS2012. 10. 24. 10:47


iOS6에서 shouldAutorotateToInterfaceOrientation가 deprecated되었답니다.

그래서 대안으로 나온게 아래 코드입니다.

shouldAutoRotate와 supportedInterfaceOrientations를 조정하면 된다네요.


아래 코드는 iOS5에서 가로모드만 지원하도록 하는 예이고.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return UIInterfaceOrientationIsLandscape(interfaceOrientation);

}


아래 코드는 iOS6에서 가로모드만 지원하는 예입니다.

- (BOOL) shouldAutoRotate{

    return YES;

}


- (NSUInteger)supportedInterfaceOrientations {

    //    UIInterfaceOrientationMaskLandscape;    24

    //    UIInterfaceOrientationMaskLandscapeLeft;    16

    //    UIInterfaceOrientationMaskLandscapeRight;    8

    //    UIInterfaceOrientationMaskPortrait;    2

    return 24;

}



Posted by 삼스