2011-02-09 7 views
1

5 개 이상의 탭이있을 때 UITabBarController가 생성하는 추가 화면에 정보 버튼을 추가하려고합니다.UITabBarController의 추가 화면에 정보 버튼 추가

// Add the info button to the more controller 
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; 
UIBarButtonItem *infoBarButton = [[[UIBarButtonItem alloc] initWithCustomView:infoButton] autorelease]; 
tabBarController.moreNavigationController.navigationItem.leftBarButtonItem = infoBarButton; 

것은 이런 종류의 다른 UIViewControllers와 잘 작동하는 것 같다,하지만이 경우, 코드를 구축하고 잘 실행되지만 버튼이 표시되지 않습니다 : 내가 사용 코드는 다음입니다.

이 기능을 사용하려면 무엇을 변경해야합니까?

답변

5

아하! moreNavigationController 자체가 아니라 moreNavigationController 스택의 첫 번째 항목에 액세스해야했습니다.

tabBarController.moreNavigationController.topViewController.navigationItem.leftBarButtonItem = infoBarButton;