2013-02-01 43 views
2

我想在我的應用程序中只將我的一個視圖右轉。 我的所有其他視圖都處於肖像模式。以前的視圖處於肖像模式。我將橫向視圖推向縱向視圖。我如何正確地做到這一點?

This portrait(rootviewcontroller)從縱向模式到iOS5,iOS6的橫向模式


This landscape

在我的橫向視圖控制器

//Orientation 
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ 
    return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 
// New Autorotation support 
-(BOOL)shouldAutorotate { 
    return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskLandscapeRight; 
} 

回答

0

您可以在您使用此瀏覽器

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

這將確保取向風景r飛行。

+0

這種方法在iOS6的 – Leena

+0

的Leena不贊成你是對的 –

0

對於一個設備,你可以做總和THNG這樣改變方向..

-(void)viewDidLoad 
{ 
    orientation = [[UIDevice currentDevice] orientation]; 
    if(intOrientation == UIInterfaceOrientationLandscapeRight) 
       orientation = UIDeviceOrientationLandscapeRight; 

} 

希望它可以幫助你

相關問題