Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone UITableViewController custom layout

I'm a beginner in iPhone programing. My first app is a UITableViewController but now I would like to experiment a little bit. The idea is to create a custom layout that would look like this:

The layout:

---------------------
Image     |    Button     
---------------------
UICalendar
---------------------
UITableView
---------------------
Button     |   Button
---------------------

QUESTION 1: As you can see I would like to add some additional UI elemnts. All the tutorials I've seen describe UITableViewController as a single UITableView (no other UI elements included in a controller). So my question would be is it possible to extend UITableViewController to have that kind of layout? What is a proper way to do it?

QUESTION 2: For UITableViewController I don't use XIB file but some people do. Why would I use XIB file when creating a UITableViewController? What are the benefits? What is the best practice?

UPDATE: Actually what I'm thinking of is to have a separated controller for UICalendar (UICalendarController) and UITableView (UITableViewController). I just don't know how to implement that.

Thx.

like image 292
xpepermint Avatar asked Jun 16 '26 20:06

xpepermint


2 Answers

The standard approach for the kind of thing you're trying to do is not to subclass UITableViewController or to use a XIB file to define the interface for the view connected with a UITableViewController, but instead to use a UIViewController with a XIB file that happens to include a UITableView in it.

You'll have to implement the UITableViewDataSource and UITableViewDelegate protocols in your UIViewController subclass, but this is not difficult.

UITableViewController is a somewhat brittle and limited class, unfortunately. It's not hard to create your own classes that use UITableViews, but it's unintuitive to many people that the right approach to doing so doesn't start with UITableViewController.

like image 112
Seamus Campbell Avatar answered Jun 19 '26 12:06

Seamus Campbell


Check out the Tapku library. It comes complete with a Calendar / Table.

like image 41
WrightsCS Avatar answered Jun 19 '26 13:06

WrightsCS