Dev/iOS2013. 4. 17. 11:06

iOS6 으로 업데이트 되면서 기존의 shouldAutorotateToInterfaceOrientation 메소드가 deprecated 되었습니다.

iOS6 에서는 shouldAutorotate, supportedInterfaceOrientations, preferredInterfaceOrientationForPresentation 이렇게 3가지 메소드로 구현해야 합니다.

deployment taget 을 5.0 부터 하기 위해서는 iOS5 방식과 iOS6 방식 2가지 모두 구현하면 됩니다.

아래 코드 참고 하세요. (landscape 모드 설정 입니다)

//iOS5 setting
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

//iOS6 setting
- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    
    return UIInterfaceOrientationLandscapeLeft;
}
  


Posted by 놀란