2011-03-27 312 views
0

我有一個2大標誌圖像。在橫向模式下一切OK。當我改變爲肖像模式時,圖像相互重疊。它們對於IB對齊太大 我可以爲每個方向設置不同的視圖嗎? 或我該如何解決這個問題。方向縱向和橫向模式

回答

0

使用下面的代碼

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

電流方向,並根據它改變你的圖像視圖幀。

+0

我也嘗試在這裏玩,但唯一想到使用不同的圖像不同的方向 – Anton 2011-03-27 18:05:59

+0

是的你必須使用不同的圖像不同的方向。 – saadnib 2011-03-27 18:07:31

1

更新至saadnib的回答。請勿使用shouldAutorotateToInterfaceOrientation。這種方法是爲了別的。

你的方法是:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 

前者稱爲發生之前旋轉,第二個是剛剛接口方向後調用。

您應該在這裏替換UIViewController的視圖,或者您也可以在這裏替換不同方向的圖像。

相關問題