Apple에 따르면 UINavigationController
과 UITabBarController
을 코드를 사용하여 결합 할 수 있습니다.Tab Bar 당 개별 UINavigationController를 사용해야합니까?
MyViewController1* vc1 = [[MyViewController1 alloc] init];
MyViewController2* vc2 = [[MyViewController2 alloc] init];
MyViewController3* vc3 = [[MyViewController3 alloc] init];
MyNavRootViewController* vc4 = [[MyNavRootViewController alloc] init];
UINavigationController* navController = [[UINavigationController alloc]
initWithRootViewController:vc4];
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, vc3, navController, nil];
tabBarController.viewControllers = controllers;
만 VC4는 UINavigationController
을 가지고,하지만 난 VC1-VC3를 원하는 경우도 UINavigationController
을 가지고 무엇을?, 내가 ... 좋아해야
MyViewController1* vc1 = [[MyViewController1 alloc] init];
UINavigationController* nv1 = [[UINavigationController alloc]
initWithRootViewController:vc1];
MyViewController1* vc2 = [[MyViewController2 alloc] init];
UINavigationController* nv2= [[UINavigationController alloc]
initWithRootViewController:vc2];
MyViewController1* vc3 = [[MyViewController3 alloc] init];
UINavigationController* nv3 = [[UINavigationController alloc]
initWithRootViewController:vc3];
NSArray* controllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nil];
tabBarController.viewControllers = controllers;
이가요 올바른 접근법?
글쎄, 이것이 당신이 원하는 것이냐에 따라 달라집니다 ... 나는 접근법이 잘못되었다고 말하지는 않을 것입니다.하지만 아마도 여러분이 기대할 수있는 결과를주지 못할 수도 있고 더 나은 접근법이있을 수도 있습니다. 당신의 목표는 무엇입니까? – Saphrosit
하나의 Tab에서 여러보기를 탐색해야하는 경우 navigationController를 사용해야합니다. 하나의 ViewController를 Tab마다 표시하려면 navigationController를 사용하지 마십시오. 그것은 모두 귀하의 요구 사항에 달려 있습니다. –