2010-02-10 64 views
0

我在管理視圖控制器旋轉時遇到困難。 這裏是我的應用程序結構:在iPhone OS 3.0上改變方向時管理子視圖

 
[Window] 
---[addSubview:MainViewController.view] 

我MainViewController的視圖包含的UIImageView,我需要旋轉,這是我的應用程序的背景。

在我的AppDelegate和MainController中,我忽略了shouldAutorotateToInterfaceOrientation返回YES,但是當我旋轉我的設備時沒有任何改變。即使是狀態欄。

當我收到UIDeviceOrientationDidChangeNotification時應該手動將轉換應用於我的視圖嗎?

在IB中,我在mainViewController.view中將resize子視圖設置爲YES。

所以我有點失落...

感謝您的幫助。

蒂埃裏

回答

0

其實,你應該重寫shouldAutorotateToInterfaceOrientation: - 發現結腸,它在ObjC顯著 - 僅在當前視圖控制器。

@implementation MainViewController 
... 
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    return YES; 
} 
+0

我就是這樣。但沒有旋轉。 – thierryb 2010-02-11 13:42:46

+0

@Thierryb:它在模擬器中工作嗎? – kennytm 2010-02-11 14:17:29