2014-12-01 4 views
0

그래서 내 문제는 여기에있다. NavigationController에 빈 ViewController를 추가했습니다. 문제는 빈 ViewController에보기를 추가하면 탐색 모음이 취소 불가능 해져서 단추를 다시 추가하거나 제목을 변경할 수 없다는 것입니다.스위프트 변경 내비게이션 막대에서 ViewController

Xcode 6.1 6A1052d를 사용하고 있습니다.

답변

1

버튼을 탐색에 직접 추가하지 않고 포함 된보기 컨트롤러의 navigationItem에 추가합니다. 예를 들어,

class ContainedViewController : UIViewController { 
    override func viewWillAppear(animated: Bool) { 
     super.viewWillAppear(animated) 

     self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: nil, action: nil) 
    } 
} 
+0

그러나 이미 뷰가 있고 내 navigationcontroller에 연결 한 ViewController를 추가하면 탐색 모음이 완전히 편집 가능한 상태로 유지됩니다. – Youri

관련 문제