2012-11-19 39 views
2

我有一個爲iPhone 4s和以前的版本創建的應用程序。一切工作正常,除了iPhone 5。我已經爲iPhone設置了縱向和縱向upsidedown,而iPad的所有方向視圖都設置了。我的問題是,手柄方向在iPhone 5中不起作用,但在以前的版本中運行良好。在將xcode升級到支持iOS 6後,我遇到了這個問題。在iPhone 5的定位問題

而且我已經發現了一些解決方案,使用這些方法的

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 」 方法

-(BOOL)shouldAutorotate { 
    return YES; 
} 

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAll; 
} 

,而不是...

A使用這也同樣,我面臨着同樣的問題...那麼我的問題是什麼,我該怎麼做才能克服這個問題?

請幫忙。

感謝您

回答

0

shouldAutorotateToInterfaceOrientation不會在iOS中使用6.So方法supportedInterfaceOrientations爲iOS 5和更早版本的工作爲主導方向在iOS 6中& shouldAutorotateToInterfaceOrientation。 以下是以下代碼:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)  
     return (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation==UIInterfaceOrientationPortrait) ;  
    else  
    return YES;  
} 

-(NSUInteger)supportedInterfaceOrientations 
{ 
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
    return (UIInterfaceOrientationMaskPortrait| 
      UIInterfaceOrientationMaskPortraitUpsideDown); 
    else  
    return UIInterfaceOrientationMaskAll;  
}