Tab bar controller not showing on page that is linked to by button

Hi guys I am really new to iOS development and very frustrated at the moment. One of the issues I have at the moment is a viewController that has a web view inside it. The view controller is linked to by a button on the main view controller and when navigated to the the tab bar is no longer at the bottom. When I connect up the tab bar with a segue then obviously there is a tab item created for the view. I have searched all day and cannot find how to simply show the tab bar on a view that is not connected to the tab bar controller or how to hide a tab bar item from the tab bar.


I have found some code but no one ever tells you where to actually implement this code. I feel like I have been walking into a wall since I started to develop on iOS and would appreciate any help as the issues I have been having have now delayed the app being launch by 4 days now. If anyone could help with this it would be greatly appreciated.

I'm assuming the view controller that has the button is one of the children of the tab bar controller. Let's call it vcA. So you have


Tab bar controller

vcA (contains button)


And when you "link to" your web view I assume it is being presented modally over top of the whole works. How it's presented would depend on the segue type you have chosen when you "link to" the web view. (I put "link to" in quotes because it is not correct iOS terminology - if you use a more correct term such as "perform a push segue" or "present modally" then it may be easier to figure out what's actually happening.)


Anyway if you want the tab bar to stay then perhaps you want vcA in a navigation controller, i.e.


Tab bar controller

Navigation controller

vcA (contains button - tapping button initiates a "show, e.g. push" segue)

web view controller


That way the child of the tab bar controller is a navigation controller. The tab bar will always be showing along with the topmost view controller on the navigation controller's stack.


Apple's View Controller Programming Guide may be helpful.

Hi thanks for the reply, so basically how it is set up is the main navigation is a tab view controller. One the home page of the app is four square buttons plus the tab bar, the squares contain links that aren't in the tab bar. To connect the buttons to the viewcontroller, I control + drag from the button to the viewcontroller not the webview, inside the view controller is two image views as banners and a web view at the bottom, it doesn't actually matter what is on the page it still has the same outcome, clicking a button that has a tab item in the tab bar even has the same effect, the issue is no matter what type of view it is linked to or how (that I have found), the tab bar disappears when the view was not navigated to by the tab bar itself. Hope this explains a little better, I will try your suggestion and see if it helps, I may be wrong as new to iOS but would't using a naviation view create a nav bar at the top ? If so this is not what my boss wants, can you think of anything else that may help if so? Thanks again.

You can hide the nav bar if you want. Take a look at the UINavigationController documentation.


How does the user get back to the four squares view after tapping one of the squares to show your web view? The native iOS approach expected by users is a navigation bar at the top with a back button on the left.

They are accessible via the home page which is in the tab bar, the navigation bar at the top is not part of the design spec I have been given. I will try your suggestion above now, thanks for the help so far. I am not sure I really get what you are meaning to do, seems like a lot of messing around, coming from an Android background having an absolute nightmare so far.

Stress over you solved it 😀 Thank you. I set the top bar to none/

DO you know a quick way to deselect the home button in tab bar, I really don't get this platform, need a lot more practise 🙂 Why would it keep the original page highlighted when you have navigated to another page ?


EDIT


Out of the frying pan and into the fire, navigate to view controller with webview, home page tab stays selected, navigate to another view via the tab bar and then o back to home takes you to the view with the webview not home, what is that all about, how hard is it to make a simple button that takes you to another page?

iOS apps do not have a "home" button. That sounds like something someone who designs web sites would come up with.


A tab bar is intended to separate portions of the UI normally based on functions / features - each tab would be a specific user task. When using a tab bar an important part of the HIG (you have read those, right?) is that when the user switches between tabs in a tab bar controller, all tabs remain in the state they were in when the user last visited. (If you are switching programmatically based on a user action, and the user knows that the action they just took is intended to change the state of the other tab, then it's fine to change it. But there should be clear user feedback about what happened.)


From your other thread asking essentially the same questions I assume that you are coming from a web design background and/or from Android where navigation is just whacked in general. 😝 I suggest spending some time playing with iOS native apps to get a feel for how they use tab bars and navigation controllers. I think if you're going to do something non standard for iOS such as having a "home" button, it will have to be in a different place such as a custom top toolbar or slide out menu.

Tab bar controller not showing on page that is linked to by button
 
 
Q