2010-12-17 7 views
0

shouldAutorotateToInterfaceOrientationメソッドでビューをロードしようとしていますが、問題があります。デバイスがランドスケープとして実行されているときは、メインビュー自体を表示し、デバイスがポートレートのときはカスタムUIViewをロードします。mainViewをshouldAutorotateToInterfaceOrientationでロードする

は、ここに私のコードです:私は考え出し

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 

     if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft)|| (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) 

      //doesn't show main view !! 
      self.view; 


     else if ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)) 

      //works fine ! 
      self.view = portraitView; 


     return YES; 

} 
+0

私は考え出した!!!!私は方法についてモーダルで私の意見を呼ぶ。 – Momi

答えて

0

!!!!ちょうどあなたがして、カスタムのUIViewをプッシュする必要があります方法

- (void) mainView { 
    screenTestViewController *mv = [[screenTestViewController alloc]initWithNibName:@"screenTestViewController" bundle:nil]; 
    [self presentModalViewController:mv animated:NO]; 

} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 

    // Return YES for supported orientations 

    if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft)|| (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) 

     [self mainView]; 


. 
. 
. 
0

のモーダルでビューを呼び出す:willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

関連する問題