2014-11-05 4 views
0

두 개의 뷰 컨트롤러가 있습니다. FirstViewController에 몇 개의 비디오가 있습니다. 비디오를 클릭하면 가로보기가있는 SecondViewController에 다시 표시되고 FirstViewController가 나타나야합니다. 여기에 내 코드가있다UNDavigationController를 사용하여 하나의 ViewController를 가로 모드로 변경하는 방법

-(NSUInteger)supportedInterfaceOrientations 
{ 

    return UIInterfaceOrientationMaskLandscape; 
} 

그러나 그것은 나를 위해 작동하지 않는다.

감사합니다.

+0

- (BOOL) shouldAutorotateToInterfaceOrientation : (UIInterfaceOrientation) interfaceOrientation { return UIInterfaceOrientationIsPortrait (interfaceOrientation); } –

+0

답장을 보내 주셔서 감사합니다.이 메서드는 @ SaurabhPrajapati – swetha

답변

0

몇 주 전에 간단한 해결책을 제안했습니다. 당신이 원하는 경우 , 당신은 세터를 호출해야이

RootViewController

@property (nonatomic, retain) BOOL autoRotate; 
@property (nonatomic, retain) UIInterfaceOrientation interfaceOrientation; 

-(void)setAutorate:(BOOL)newValue 
{ 
    _autoRotate = newValue; 
} 
-(void)setInterfaceOrientation: (UIInterfaceOrientation)newInterface 
{ 
    _interfaceOrientation = newInterface; 
} 

-(BOOL)shouldAutorotate 
{ 
    return _autoRotate; 
} 
-(UIInterfaceOrientation)supportedInterfaceOrientation 
{ 
    return _interfaceOrientation; 
} 

그리고 secondView의 컨트롤러를하고 두 번째 뷰 컨트롤러의 프리젠 테이션에 rootviewcontroller의 shouldAutoRotate/supportedInterfaceOrientation의 반환 값을 연결할 수 있습니다 메서드를 사용하여 값을 수정하십시오. 그런 다음 viewDidDisappear에서 또는 컨트롤러를 닫을 때 값을 다시 설정합니다.