Cycle through subviews in main viewcontroller

Discussion in 'iOS Programming' started by Will0827, Jun 23, 2015.

  1. Will0827 macrumors regular

    Will0827

    Joined:
    Aug 11, 2008
    #1
    Was having a hard time exactly framing the question, in essence i want to recreate the uitabbar functionality but with a custom tab bar with more buttons then the four allowed before they get grouped into the more. i coudln't figure it out in storyboards so what i ended up doing was creating an instance for each of the other viewcontrollers in the main viewcontroller file. I made the uibuttons when pressed add a subview to the view of the main view controller. All the subviews are loading fine and my desiered functionality is working atleast in displaying the views in the size that i want each to be, but im afraid that by doing it this way when i press the button to jump to another view, the instance for the current subview will get released and stop the process happening in that view. What would you guys suggest as a better way to go about this. Thanks MR family.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Obviously you should be using the child view controller APIs for this. To keep all the views in memory simply keep an array of the view controllers. Each view controller retains its view.

    If you look for some open source code for side menus you'll probably find examples of this.
     

Share This Page