2012-01-26 104 views
0

我強制在我的iPhone應用程序中的視圖始終處於「橫向視圖」。然而,這顯然做的是,當iPhone垂直放置時,風景中的視圖也垂直放置,而其中一半不在屏幕外。我該如何做到這一點,使整個橫向視圖始終可見(如果iPhone水平放置,可以看到完整的橫向視圖,並且如果iPhone垂直放置,則全視圖也可見,只能在側面旋轉) ?iPhone應用程序定位

回答

0

您是否有一系列分層視圖?在基本視圖控制器的shouldAutorotateToInterfaceOrientation()方法中,添加:

return (interfaceOrientation == UIInterfaceOrientationLandscape); 

它不會傷害到添加到所有視圖控制器,如果應用程序是所有景觀所有的時間。

+0

這個工作做與此有關。但是,當應用程序以縱向方向啓動應用程序時,問題仍然存在(當然,在我翻轉設備之前)。我如何確保我從一開始就想要他們? –

+0

我現在不在我的Mac上查看,但我相信您可以通過應用程序主plist中的屬性設置初始方向。 – MystikSpiral

0

嘗試在的viewController

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