탐색 컨트롤러에 포함 된보기 컨트롤러가 있습니다.UINavigationBar에서 탐색 항목을 설정할 때 오류가 발생합니다.
탐색 모음에서 막대 중앙에 segmentedControl이 있고 오른쪽에 편집 단추가 있습니다.
내가 편집 버튼을 누릅니다
은, 다음 코드는 해고 :func editAction() {
if homeworkTasksVC?.editing == false {
// Set to editing
homeworkTasksVC?.setEditing(true, animated: true)
// Switch to "Done" button and 'Homework' title without segmented control
let navBar = self.navigationController?.navigationBar
let navItem = UINavigationItem(title: "Homework")
let doneButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: #selector(TasksParentViewController.editAction))
navItem.rightBarButtonItem = doneButton
navBar!.setItems([navItem], animated: true)
} else {
// Stop editing
homeworkTasksVC?.setEditing(false, animated: true)
// Switch back to "Edit" button and segmented control
let navBar = self.navigationController?.navigationBar
let navItem = UINavigationItem(title: "Homework")
navItem.titleView = segmentControl
let editButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Edit, target: self, action: #selector(TasksParentViewController.editAction))
navItem.rightBarButtonItem = editButton
navBar!.setItems([navItem], animated: true)
}
}
(참고 : homeworkTasksVC가 참조하는 문제의보기 두보기 사이를 전환보다 UIPageViewController 때문에)
문제가 : 편집을 탭하면 분할 된 컨트롤이 아무런 문제없이 텍스트 제목을 전환 한 다음 다른보기로 이동하는보기에서 셀을 탭하면 BUT 다시 "편집"을 탭하면 다시 전환됩니다. 이 원래보기로 돌아가려면 '뒤로'를 탭한 다음 편집을 누릅니다. 이성 앱 종료 * 때문에 'NSInternalInconsistencyException'캐치되지 않는 예외
2016년 6월 22일 : 00 : 38 : 59.272 2.0 [386,949 1,504] t는 다음 출력 충돌 'setItems를 호출 할 수있다 : 애니메이션 : 컨트롤러에 의해 관리되는 UINavigationBar에 직접. ' * 우선 투사 호출 스택 : (0x23c85b0b 0x23442dff 0x23c85a51 0x283a0ced 0x118318 0x1189c8 0x2829b6a1 0x2841e0b9 0x2829b6a1 0x2829b631 0x2828356b 0x28283697 0x2829af51 0x2829abbf 0x28293547 0x28263dd5 0x28262379 0x23c479e7 0x23c475d7 0x23c4593f 0x23b941c9 0x23b93fbd 0x251b0af9 0x282cc435 0xe8cb4 0x23840873) 의 libC++ abi.dylib : 캐치되지 않는 예외의 종료 NSException (lldb)를 입력
코드로 설명해 주시겠습니까? :) 나는 그것이 내가 벌써하고있는 것 같은 느낌이 든다. ..? – Max
답변을 업데이트했습니다. – robinkunde