Akshay
Akshay

Reputation: 2983

UITabBar with TableView using Nib

I am developing one application which contains one TabBar. OnTouch of a tab bar item I am loading a different nib. This nib contains a navigation bar + tableview. I am connecting the datasource and delegates of the table to the File's Owner and getting the following error. enter image description here

When I am disconnecting the dataSource with the file's owner then it is responding but the Table Functions are not working.

Any suggestions how can I make the TableView functions working ?

EDIT :

My .h file : enter image description here

.m file : enter image description here

Xib Connections enter image description here

Still the same error. :(

Upvotes: 0

Views: 162

Answers (2)

sergio
sergio

Reputation: 69027

Your data source does not implement the tableView:numberOfRowsInSection:, that's the reason of the error.

If you have doubts about it, please post the data source implementation, so we can help further.

EDIT: a few more checks...

  1. How are you loading the nib file? initWithNibName or loadNibNamed?

  2. Is the controller view outlet connected to your view? (I guess so, but just asking)

  3. Are you doing anything special in your controller's initWithNibName, loadView, or viewDidLoad?

If in doubt, add more code from those methods (text is fine)

Upvotes: 1

marzapower
marzapower

Reputation: 5611

If you are using your UIViewController as delegate and data source for its table, it has to implements the methods from the UITableViewDataSource and UITableViewDelegate protocols.

The method tableView:numberOfRowsInSection: is one of those strictly required in the class that implements the UITableViewDataSource protocol, so you probably want to fix this implementation.

Upvotes: 1

Related Questions