Is it possible to use Tabbar/Nav Controller on Multipleviews in One ViewController?

Discussion in 'iOS Programming' started by frostshoxx, Jan 26, 2011.

  1. frostshoxx macrumors newbie

    Nov 12, 2008
    Hi everyone,

    I've been working on a personal project, which starts with one view controller.

    I have add multiple views into it and call each view by using this method
    self.view = self.newView;

    It seems to work fine and I don't have to worry much about sharing data since all the views are in the same controllers.

    Recently, I just become interested in using Navigation Controller or Tab Bar Controllers to navigate the views.

    However, from most of the tutorials and the books I found, they all seem to have a view controller for each view that needs to be hooked to the navigation controller.

    So I'm just wondering if it is possible to use either navigation or tab bar controller with just one view controller that contains multiple views in it?

    Thank you for the guidance.
  2. Nobita macrumors 6502

    Oct 5, 2008
    La la land
    That would be quite hard. You see, tab bar controllers are just basically placeholder for two or more view controllers (which will be called when you press the tabs).

    If I were you I would create separate classes for each one of your view controllers, then call each one of them from your ui tab bar controller. Do you understand what I mean?

    Look around, there's quite a lot of tutorials on this topic on youtube and stackoverflow. A lot of people (including me) were very confused about this before.

Share This Page