2012-03-15 6 views
0

나는 앱이 navigation controller인데, 내 앱에도 navigation controller이 아닌 간단한 별개의보기가 있습니다. 그리고 내가하고 싶은 일은이 뷰에 새로운 navigation controller 브랜드를 추가하는 것입니다. 내 AppDelegate에이 코드를 사용하는 첫 navigation controller를 들어 :앱의 여러 가지 내비게이션 컨트롤러

UINavigationController *navigationController = [[UINavigationController new] initWithRootViewController:viewController1]; 

    navigationController.viewControllers = [NSArray arrayWithObject:viewController1]; 

    self.window.rootViewController = navigationController; 

하지만 사용해야 코드, 나는 새로운 Navigation Controller을 만들려면?

감사합니다.

는 UPDATE :

한 첫 번째 그림은 (AppDelegate에에 선언)을 navigation controller가 :

그래서, 나는 약간의 사진을했다. 정보 버튼이 있습니다. 그런 다음 버튼을 누르면 다른보기로 이동합니다 (그림 2). 이보기에서는 navigation bar 일 뿐이지 navigation controller이 아닙니다. 사용자가 쉽게

enter image description here

enter image description here

+0

UITabBarController를 사용 해본 적이 있습니까? 나는 당신의 디자인을 완전히 이해할 수 없다. 무엇을 성취하려고합니까? – Canopus

+0

아니요, UITabBarController를 사용하지 않습니다. 난 그냥보기에 새로운 탐색 컨트롤러를 추가하고 싶습니다. 그리고이보기는 내 첫 번째 탐색 컨트롤러의 일부가 아닙니다. 그리고 AppDelegate에서 사용한 코드를 사용할 수 없습니다. – SmartTree

답변

2

우리는 의도 뷰에 대해 좀 더 알 필요가 UITableView을 사용할 수 있도록 내가 탐색 컨트롤러,이보기가 아닌 탐색 모음을 추가 싶어 계층 및 응용 프로그램 흐름. 하지만 게시하는 코드에서 무슨 일이 일어나고 있는지 잘 모르겠습니다. 왜 그냥 : 다른 UINavigationController들에게 정확히 같은 방식으로 만들 것이라고 말했다

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController1]; 
self.window.rootViewController = navController; 

.

업데이트 : 첫 번째보기에서 정보 버튼을 누르면

, 당신은 내가 생각 모달 네비게이션 컨트롤러를 제공 할 수있다.

- (IBAction)infoButtonAction:(id)sender; 
{ 
    // InfoTableViewController is the controller with Instructions, Contact, and something else 
    // my Russian isn't so good. 
    InfoTableViewController *tableController = [[InfoTableViewController alloc] initWithStyle:UITableViewStyleGrouped]; 
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:tableController]; 
    navController.modalPresentationStyle = UIModalPresentationFormSheet; // or whatever 
    [self presentModalViewController:navController animated:YES]; 
} 

내가 ARC인지 여부를 모르므로 메모리 관리를 다루지는 않습니다. 그것은 그것이 어떻게 행동해야 하는가?

+0

감사합니다! 예, 내 앱에는 탐색이 있습니다. 컨트롤러는 AppDelegate에 선언되어 있습니다. 그래서 잘 작동하지만이 탐색 바의 일부가 아닌보기도 있습니다. 그리고 네 개의 뷰 중 하나에 새로운 네비게이션 컨트롤러를 추가하려고합니다. 그러면 전체 앱에 두 개의 네비게이션 컨트롤러가 생깁니다. 위의 코드를 시도했지만 .m 파일에 ** self **를 쓸 때 xcode는 ** window **를 선택하지 않습니다. 작동하지 않습니다. 죄송합니다. – SmartTree

+0

이 세 가지 다른 뷰는 뷰 계층 구조에서 어디에 있습니까? 아마도 우리는 당신에게 더 많은 도움이 될 수 있습니다. @Canopus가 제안했듯이, 나는 또한 'UITabBarController' 디자인이 당신이 원하는 것처럼 들린다는 느낌을 갖지만, 말하기는 어렵습니다. – FluffulousChimp

+0

제 편집 내용을 확인하십시오. – SmartTree

관련 문제