2011-03-16 6 views
2

rightBarButtonItem 속성을 제외하고 UITabBarController의 moreNavigationController의 모든 속성을 설정할 수있는 매우 이상한 문제가 있습니다. 모든 바 오른쪽 단추 항목을 사용할 수 없게하는 customizableViewControllers 속성과 관련된 일부 버그로 인해 발생할 수 있습니다. 어떤 아이디어를 수정하는 방법?UITabBarController의 moreNavigationController 오른쪽 버튼을 설정할 수 없습니다.

UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] 
            initWithBarButtonSystemItem:UIBarButtonSystemItemDone 
            target:self 
            action:@selector(popViewController)]; 

    self.customizableViewControllers = nil; 
    self.moreNavigationController.navigationBar.barStyle = UIBarStyleBlack; 
    self.moreNavigationController.topViewController.navigationItem.title = @"test"; //this works 
    self.moreNavigationController.topViewController.navigationItem.leftBarButtonItem = doneButton; // this works 
    self.moreNavigationController.topViewController.navigationItem.rightBarButtonItem = doneButton; // this doesn't 

답변

5

확인 솔루션은 moreNavigationController

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *) viewController animated:(BOOL)animated { 

viewController.navigationItem.rightBarButtonItem = doneButton; 

} 
의 대표
0

Paludis, 덕분에 많이 사용하는 것이었다! 이것은 현재 수정 사항입니다.

func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) { 
     //More navigation controller Bug. The rightBarButton item disappears on pop, in case this is MoreNavControl 
     navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "createProject") 
    } 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     if (self.navigationController == self.tabBarController?.moreNavigationController) 
     { 
      self.navigationController?.delegate = self 
     } 
     else 
     { 
      navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "createProject") 
     } 
} 
관련 문제