2012-10-22 1 views
0

맞춤형 비디오 카메라로 작업하고 있습니다. 녹화를 쉽게하려면 세로로보기 위해 카메라가 오버레이되어 있지만 가로로 보이는 것처럼 보입니다. 이 작품은 프로젝트의 특성상 비디오가 너비가 길어지기를 바란다. 현재 iOS 6에서 내 View Controller를 세로 방향으로 회전시키고 portraitUpsideDown을 landscapeLeft 및 landscapeRight로 회전 할 때 문제가 발생합니다. 어쨌든 iOS 6에서보기 컨트롤러가 가로로 회전 할 때 세로로 회전하도록 알려주고 있습니까? 이전에 나는 iOS6의 이러한 변경 사항에 대한 스택 오버 플로우에있는 다른 많은 문서 검토 한iOS 6에서 장치 가로 방향 인 경우 UIViewController를 세로로 회전

- (BOOL)shouldAutorotate { 
    return YES; 
} 

- (NSUInteger)supportedInterfaceOrientationsForWindow { 
    return UIInterfaceOrientationMaskPortrait; 
} 

나는 이러한 방법으로 놀있어 현재

shouldAutoRotateToOrientation 함께 할 것이다 아직하지 않은 이 문제에 대한 해결책을 찾았습니다.

답변

0

우리는 일할 수있었습니다.

@interface YourViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> 
{ 
    UITableView *myTableView; 
    CGAffineTransform _originalTransform; 
    CGRect _originalBounds; 
    CGPoint _originalCenter; 
} 

@property (nonatomic, retain) UITableView *myTableView; 

@end 
: (이/회사 정책의 c를 내가 모든 것을 표시 할 수 없습니다 b를 부분적이다)

먼저 인터페이스에서 : 우리는 풍경에 대한했지만 당신은 노호 코드를 수정하여 세로 위해 그것을 할 수 있습니다

다음은 구현 예입니다.

@implementation YourViewController 

@synthesize myTableView; 

- (void)loadView { 

    UIView *viewContainer = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; 

    CGRect tableFrame; 
    tableFrame.origin.x += 10; 
    tableFrame.origin.y -= 15; 
    tableFrame.size.height = 320; 
    tableFrame.size.width = 460; 

    // create and configure the table view 
    myTableView = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain]; 

    myTableView.delegate = self; 
    myTableView.dataSource = self; 
    myTableView.autoresizesSubviews = YES; 
    myTableView.scrollEnabled = YES;  
    myTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 


    [viewContainer addSubview:myTableView]; 
    self.view = viewContainer; 
} 

- (void)viewWillAppear:(BOOL)animated { 

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

    _originalTransform = [[appDelegate navController].view transform]; 
    _originalBounds = [[appDelegate navController].view bounds]; 
    _originalCenter = [[appDelegate navController].view center]; 

    CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(3.14/2)); 
    //landscapeTransform = CGAffineTransformTranslate (landscapeTransform, +80.0, +100.0); 

    [[appDelegate navController].view setTransform:landscapeTransform]; 

    [appDelegate navController].view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 
    [appDelegate navController].view.bounds = CGRectMake(0.0, 0.0, 480.0, 320.0); 
    //[appDelegate navController].view.center = CGPointMake (240.0, 160.0); 

    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight; 
} 

- (void) viewWillDisappear:(BOOL)animated { 

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    [[appDelegate navController].view setTransform:_originalTransform]; 
    [[appDelegate navController].view setBounds:_originalBounds]; 
    [[appDelegate navController].view setCenter:_originalCenter]; 

    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait; 
}