2012-09-13 3 views
0

사용자가 카메라를 활성화 할 때 장치 (iPhone/iPod/iPad)가 세로로 고정되어있는 경우 사용자에게 장치를 가로 방향으로 회전하도록 알리고 싶습니다. 사진/녹화 비디오를 가로로 가져 가야합니까?사진/비디오를 가로로 찍는 Xcode

그러나 app ​​(모든 내 UIViewController, UITableViewController 등)은 세로 모드에만 있으며 가로 방향은 아닙니다.

답변

0

확인 인터페이스 방향 :

6 자동 회전이 약간 변경되었습니다 아이폰 OS에서
if (UIInterfaceOrientationIsPortrait([UIDevice currentDevice].orientation)) 
{ 
    // call methods to take picture 
    .... 
} 
else 
{ 
    // alert the user this device is not landscape mode 
    ... 
} 
+0

당신의 제안은 좋다. 그러나 카메라가 활성화 된 후 사용자가 장치를 세로 모드로 다시 돌리면 (즉, UIImagePickerController가 SourceTypeCamera 및 presentModalViewContoller로 설정됨을 의미), 이는 목적을 상회합니다. 카메라를 활성화해도 카메라가 가로 방향으로 돌아갈 때까지 사진을 찍을 수있는 "카메라"버튼이 비활성화되어 있는지 확인하려면 어떻게합니까? –

+0

UIImagePickerController 하위 클래스 또는 범주 및 메서드를 재정의해야한다 - (BOOL) shouldAutorotateToInterfaceOrientation : (UIInterfaceOrientation) toInterfaceOrientation – user1203650

0

그러나 같은 접근 방식은 여전히 ​​노력하고 있습니다.

샘플 코드 :

@implementation UIImagePickerController (noRotation) 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation /* iOS 5 */ 
{ 
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation); 
} 

- (NSUInteger)supportedInterfaceOrientations /* iOS 6 */ 
{ 
    return UIInterfaceOrientationMaskLandscape; 
} 

@end 
관련 문제