내 TabBarView에 navigationBar가 있습니다. 내 navigationBar에 rightBarButtonItem과 제목이 필요합니다. 왜 이런 일이 일어나는 걸까요? 내 코드는 viewDidLoad 메서드에 있습니다. 내 제목이 왼쪽 단추 항목으로 표시되는 이유는 무엇입니까? 그런 다음 클릭하면보기가 움직이는 것처럼 작동하고 오른쪽 막대 버튼 항목이 사라지고 제목이 정확합니다.제목이 왼쪽 버튼으로 표시되는 이유는 무엇입니까?
UINavigationBar *myNavBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320,40)];
myNavBar.barStyle = UIBarStyleBlackOpaque;
[self.view addSubview:myNavBar];
//Creates the title.
UINavigationItem *title = [[UINavigationItem alloc] initWithTitle:@"My Title"];
[myNavBar pushNavigationItem:title animated:NO];
//Creates the button.
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self
action:@selector(showMail:)];
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:nil];
navItem.rightBarButtonItem = button;
// add the UINavigationItem to the navigation bar
[myNavBar pushNavigationItem:navItem animated:NO];
왜 어떤 일이 발생합니까? –
질문의 제목은 무슨 일이 일어나는지 말해줍니다. 어쩌면 거기에 그걸 포함시켜야 할 것 같아. 내 제목이 왼쪽 단추 항목으로 표시되는 이유는 무엇입니까? 그런 다음 내가 그것을 클릭하면 lke가보기를 움직이고 오른쪽 막대 버튼 항목이 사라지고 제목이 정확합니다. – Jason