issue with tab bar view displaying a compound view
Posted
by ambertch
on Stack Overflow
See other posts from Stack Overflow
or by ambertch
Published on 2010-04-19T10:35:42Z
Indexed on
2010/04/19
10:43 UTC
Read the original article
Hit count: 184
iphone
|iphone-sdk
I created a tab bar application, and I make the first tab a table. So I create a tableView controller, and go about setting the class identity of the view controller for the first tab to my tableView controller.
This works fine, and I see the contents of the table filling up the whole screen.
However, this is not what I actually want in the end goal - I would like a compound window having multiple views: - the aforementioned table - a custom view with data in it
So what I do is create a nib for this content (call it contentNib), change the tab's class from the tableView controller to a generic UIViewController, and set the nib of that tab to this new contentNib.
In this new contentNib I drag on a tableView and set File's Owner to the TableViewController. I then link the dataSource and delegate to file's owner (which is TableViewController).
Surprisingly this does not work and I receive the error:
**Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x3b0f910'**
This is bewildering to me since the file's owner is the TableViewController, which has been assigned to be both the dataSource and delegate. Does someone have either insight into my confusions, or a link to an example of how to have a compound view include a tableView?
*update* I see this in the Apple TableView programming guide: "Note: You should use a UIViewController subclass rather than a subclass of UITableViewController to manage a table view if the view to be managed is composed of multiple subviews, one of which is a table view. The default behavior of the UITableViewController class is to make the table view fill the screen between the navigation bar and the tab bar (if either are present)." <----- I don't really get what this is telling me to do though... if someone can explain or point me to an example I'd be much appreciated!
© Stack Overflow or respective owner