Making UITableView by source code (Without Interface Builder)

Discussion in 'iOS Programming' started by rodrigozanatta, Feb 25, 2011.

  1. rodrigozanatta macrumors newbie

    Nov 22, 2010
    I have to build a UITableView windows using only the source code (without Interface Builder). I tried to find in a lot of place but didn't found any thing.

    So, anyone know where I can find a sample that do this? Or anyone use this in your source code?

  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    UITableViewController creates a tableview for you. No nib required. The only restriction is that UITableViewController wants its table to take up the full screen, except for a navbar or tabbar.

    If you can make your view controller a subclass of UITableViewController that's the simplest way to do this.

    Otherwise there's nothing much special about creating a table view in code. Create it. Set its frame. Set its delegate and dataSource. Add it to the view hierarchy. That's about it.

Share This Page