2012-08-06 4 views
0

가로로 회전하면 새로운 뷰가 스택에 푸시되고 세로로 회전하면 뷰가 팝업되는 탐색 컨트롤러를 만들려고합니다. 지금까지 가로보기를 표시 할 수 있지만,보기 컨트롤러를 스택에 다시 밀어서 세로를 가져올 수있는 유일한 경우입니다. 나는 사용자가 연속적으로 앞뒤로 회전 할 경우 스택에서 메모리가 부족하다고 가정합니다. popToViewController를 사용하여 시도해도 아무 일도 일어나지 않습니다. 누군가 팝업 기능을 작동하도록 도울 수 있습니까?지속적으로 뷰 컨트롤러를 밀어 넣기

이 방법은 내의 ViewController 클래스에 있습니다

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
    if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
     toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     AppDelegate *delegate = 
     (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

     Landscape *landScape= 
     [[Landscape alloc] initWithNibName:@"Landscape" bundle:nil]; 

     [delegate.navController pushViewController:landScape animated:YES]; 
    } 
} 

이 방법은 내 풍경 클래스 : 이미 스택에 있어야 당신의 ViewController를 보인다

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
    if(toInterfaceOrientation == UIInterfaceOrientationPortrait || 
      toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) 
    { 
     AppDelegate *delegate = 
     (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

     ViewController *viewController= 
     [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 

     [delegate.navController pushViewController:viewController animated:YES]; 
    } 
} 

답변

1

, 그래서 당신이해야 [delegate.navController pushViewController:viewController animated:YES]; 대신 [delegate.navController popViewControllerAnimated:YES];을 호출하여 다시 가져올 수 있습니다.

+0

확인. 멋지다. 나는 [delegate.navController popViewControllerAnimated : YES]를 배치했다. 조경 방법에서 그것은 작동했다. 감사. – apples