문제

I have a simple app where I push views to the navigation. However, on one of the screens I push tab controller with two tabs. When I do this the navigation goes away when I reach the tab controller screen. On the navigation of the tab screens I would like to know how a < Back button.

Basically, I want to know how to manually create a < Back button on top left

도움이 되었습니까?

해결책

Try this:

UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_back.png"] style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = backBarButton;

Then write the goBack method:

- (void)goBack:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

Note: There are some other initializer for UIBarButtonItem. Choose any one as your need.

Hope this helps.. :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top