시작하는 데 탐색 막대가있는보기 컨트롤러가 있습니다.
일부 UIViewConrollers 후에 각 탭 막대에 4 개의 탭 막대와 4 개의보기 컨트롤러를 만든 탭바 컨트롤러를 추가했습니다.
이제 각 탭과 관련된 탐색 모음이있는 탭 모음을 만들면 상단에 두 개의 탐색 모음이 표시됩니다. 탐색 모음이없는 탭 모음을 만들면 하나의 탭 모음 만 표시되지만 각 탭보기 컨트롤러에 해당하는 제목을 추가 할 수는 없습니다 네비게이션 바
는 여기에 당신은 뷰 컨트롤러의 navigationItem
에의 참조를 취득하고 title
를 설정할 수있는 탭 표시 줄보기 컨트롤러에서 하위보기의 탐색 모음 제목을 설정하는 방법은 무엇입니까?
EventDetailViewController *firstViewController = [[EventDetailViewController alloc]init];
firstViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Home" image:[UIImage imageNamed:@"Multimedia-Icon-Off.png"] tag:2]autorelease]; MoreInfo *secondViewController = [[MoreInfo alloc]init];
secondViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Info" image:[UIImage imageNamed:@"Review-Icon-Off.png"] tag:0]autorelease];
PlaceInfoViewController *thirdViewController = [[PlaceInfoViewController alloc]init];
thirdViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Lugar" image:[UIImage imageNamed:@"Place-icon-OFF.png"] tag:1]autorelease];
FavoritesViewController *forthViewController = [[FavoritesViewController alloc]init];
forthViewController.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Compartir" image:[UIImage imageNamed:@"Compartir-Icon-Off.png"] tag:3]autorelease];
UITabBarController *tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBarController.viewControllers = [[NSArray alloc] initWithObjects:firstViewController, secondViewController, thirdViewController, forthViewController, nil];
tabBarController.view.frame = self.view.frame;
[self.view addSubview:tabBarController.view];
[firstViewController release];
[secondViewController release];
[thirdViewController release];
[forthViewController release];
질문이 명확하지 않습니다. 네비게이션 바 제목 설정을 원하십니까? – QueueOverFlow
@stackBlue 예 .. 하위보기 컨트롤러에서 내비게이션 막대의 제목을 원합니다 ... –
try .. in viewDidLoad. self.title = @ "내 제목"; – QueueOverFlow