2011-08-02 12 views
1

私はUIViewControllerとRootViewControllerに背景イメージを持っています。UIImageViewがサブビューとしてウィンドウに追加されたときに向きを変更していません

 MainMenuBavkGround_ipad *backImage = [[MainMenuBavkGround_ipad alloc] initWithNibName:@"MainMenuBavkGround_ipad" bundle:[NSBundle mainBundle]]; 
    RootViewController *rootviewController = (RootViewController *)[navigationController.viewControllers objectAtIndex:0]; 
    backImage.m_rootViewController = rootviewController; 
    rootviewController._buttons = Buttons; 
    rootviewController.tableView.contentInset = UIEdgeInsetsMake(250.0, 200.0, 0.0, 0.0); 
    rootviewController.view.backgroundColor = [UIColor clearColor]; 
    [window addSubview:navigationController.view]; 
    [window addSubview:backImage.view]; 

しかし、今のUIViewController(MainMenuBavkGround_ipad)はその向きを変えていないが、次のように私は、ウィンドウ内のViewControllerのビューの両方が追加されました。 shouldAutorotateToInterfaceOrientationを呼び出さなくても。

ウィンドウ内でビューを追加する順序が逆の場合、RootViewControllerのビューは向きを変更していません。

UIViewControolerのビューをウィンドウに追加し、UIViewControllerのビューにRootViewControllerのビューを追加すると、rootViewControllerのviewDidAppearが呼び出されません。

私はshouldAutorotateToInterfaceOrientationを手動で呼び出そうとしました。しかしそれは働かない。

どのようにすればいいですか?

+0

感謝 – KodeKiller

答えて

0

解決済みの問題!!!!!!

documentation私は2つのviewcontrollerのビューをウィンドウに追加できません。だから私が試みたのは、テーブルビューの背景を設定する方法を検索したことです。私はユーザーama269によってpostを得て、次に私は次のコードで画像にウィンドウの背景色を設定しました。

window.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"scrn_01_iPad.png"]]; 

私の視点からオリエンテーション通知を受けるたびに、次のように異方向イメージを変更します。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {; 
if((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)) 
{ 
    if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"1st_scrn_iPad_L.png"]]; 
    } 
    else 
    { 
     self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"scrn_01_iPad.png"]]; 

    } 
} 

}

そして私の問題は、呼び出しを受ける今rootViewControllerのviewDidAppearを解決しています。私の画像の向きも処理されます。私がそれは、[参照](http://developer.apple.com/library/ios/#qa/qa1688/_index.html)を参照してください扱うことができないようだama269

関連する問題