Reputation: 6490
I am new to iOS,
I am developing shopping App for IPhone using Storyboard,
Here is the snapshot of my App,
TabBarController
contains 4 Tab with NavigationController
When i open Tab1
(let say class1
) it contains TableView
, onclick of tableview it will take me to Detail page
with title and back button on NavigationBar
(I am adding title and back button programatically in ViewWillAppear method
) after this when i hit back button i navigates to previous page properly, this is working fine..
My problem is When i open Tab1
(i.e class1) and when i navigates to Detail page
after selecting a row in tableview, in a Detail page
, BackBtn
and title will be added in NavigationBar
bcoz ViewWillAppear method
will be called, and when i hit Tab2
before hitting Backbtn, i am navigates to class of Tab2
and thn when i comes back to Tab1
and now i clicks on back button i am navigating to previous page of my Tab1 class
(i.e class1
) but on class1
back Button and title of Detail page
is there on my class1
i am unable to hide it...
You can see in the 2nd image BackBtn
and Title
is there in Class1
..
What's the problem ?
Upvotes: 1
Views: 4773
Reputation: 4480
[btnBack setHidden:YES]
in viewWillDisapper:
method in Detail page
Upvotes: 3
Reputation: 860
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
Will give you which item you are currently selecting.
You can work around if you cant fix it by popping to root view controller and pushing it again. And make sure you are not adding a subview in place of pushing a view controller.
Upvotes: 0
Reputation: 20541
just hide that backButton in viewWillAppear:
method of Class1
like bellow...
[self.navigationItem setHidesBackButton:YES animated:YES];
or
[self.navigationItem setHidesBackButton:YES];
UPDATE:
if you add custom button to the UINavigationBar
then just remove that button like bellow...
self.navigationItem.leftBarButtonItem = nil;
and if you want to remove right bar button then use bellow another code like above...
self.navigationItem.rightBarButtonItem = nil;
i hope this helpful to you...
Upvotes: 7