2012-01-16 83 views
0

我正在顯示一個視頻,我需要視圖進行旋轉以便以橫向顯示。我寫了下面的代碼,它正是我想要的。問題是,當我點擊後退按鈕時(顯示運營商和時間標題的欄)仍爲橫向(對於假設爲縱向的視圖)。我如何糾正這一點?在橫向顯示視圖

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 

回答

0

現在只要把你的幀新的位置,即:

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ 
    if(self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
     self.interfaceOrientation == UIInterfaceOrientationLandscapeRight){ 
     video1.frame = CGRectMake(50, 650, 150, 30); 
     video2.frame = CGRectMake(350, 650, 150, 30); 
    } else { 
     video1.frame = CGRectMake(10, 10, 150, 30); 
     video2.frame = CGRectMake(610, 10, 150, 30); 
    } 
} 

,離開這個就像是怎麼回事

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

可以打電話給你希望它改變的方法取向。所以它知道..

例如:

-(void)videoDisplayMothod { 
    //video code 
    toInterfaceOrientation = UIInterfaceOrientationLandscapeLeft; 
} 
0

是否定義:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

用於其觀點,就是要肖像控制器? (您在關閉視頻後返回的那個)

相關問題