Data Driven Apps or 1 xib for many Controllers?

Discussion in 'iOS Programming' started by KingAndrew, Jan 15, 2010.

  1. KingAndrew macrumors newbie

    Joined:
    Jan 15, 2010
    #1
    Hi All,
    I have been developing my first app with a Tabbar controller that has a UIViewController + XIB for each tab.

    After implementing 3 out of the 5 tabs I realized that my views are all pretty much the same. 1 image on the top with a table toward the bottom.

    Since they have the same basic layout (some images may be bigger than others). I'd like to have one view controllers and then pull in the image and data for the table each time I select a new tab.

    So my questions are:
    1) How do I know what tab I'm on when they all use the same controller?
    2) How to I get to the UIImage and UITableView so I can set the image and the sizes for both?
    3) I'll also be adding a varying number of UIButtons to the View that are not in the nib. How do I do that?

    Thanks in advance,

    Andrew
     
  2. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #2
    If they're that simple why don't you just do it all in code rather than messing about with xibs?
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    There's a couple of properties of your UITabBarController than will tell you that.
     
  4. KingAndrew thread starter macrumors newbie

    Joined:
    Jan 15, 2010
    #4
    That sounds reasonable. Do you have any pointers on how to do that?

    How do I get the MainWindow?

    As I mentioned I'm 3/4 way through my first book and it does (most) everything with IB.

    Any pointers would be a big help.

    Thanks,

    Andrew
     
  5. KingAndrew thread starter macrumors newbie

    Joined:
    Jan 15, 2010
    #5
    How do I get a handle to my UITabbarController?
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Either set up an IBOutlet, if it's defined via Interface Builder, or set up some kind of instance variable that is set when the UITabBarController is instantiated.
     

Share This Page