0

나는 을 SplitViewController에 대한 상세보기로 사용하는 프로젝트를 가지고 있습니다.UINavigationController & SplitViewController

그래서 앱이 나타나면 두 방향 모두에 문제가 없습니다. 그러나 내 탐색 컨트롤러 내부에서 뷰를 누르면 곧 세로 모드에있는 '내 마스터 뷰보기'(uisplitview 대리자) 단추가 사라지고 uinavigationcontroller의 '뒤로'버튼이 대신됩니다. 뒤로 버튼을 눌러 내보기를 팝업하면 '보기 마스터보기'버튼이 다시 나타납니다.

내 질문은, 어떻게 내가 두 단추 ('뒤로', '쇼 마스터')를 내 UINavigationBar에 표시 할 수 있기를 원한다는 사실을 관리합니까?

답변

0

일반 UINavigationBar으로는 그럴 수 없습니다.

"쇼 마스터보기"버튼을 다른 곳에 배치해야합니다 (예 : 상세보기 하단의 UIToolbar에 있습니다.

나만의 NavigationController와 NavigationBar를 코딩 할 수도 있지만 좀 더 많은 작업이 필요합니다. :)

1

UIToolbar로 할 수 있습니다. 먼저 탐색 막대를 숨기고 UiToolbar를 뷰의 맨 위에 배치해야합니다.

이제 버튼을 원하는대로 추가 할 수 있습니다.

UIToolbar *tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 20, 1036, 42)];   
tools.barStyle = UIBarStyleBlackTranslucent; 
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3]; 

UIBarButtonItem * backButton = [[UIBarButtonItem alloc] initWithCustomView:myCustomView]; 
[buttons addObject:backButton]; 

//you can add also a spacer 
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 
[buttons addObject:spacer]; 

UIBarButtonItem * homeButton = [[UIBarButtonItem alloc] initWithCustomView:myCustomView]; 
[buttons addObject:homeButton]; 
[tools setItems:buttons animated:NO];