Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jamshid2

macrumors newbie
Original poster
Nov 13, 2009
6
0
Hello,

I want to make a view in which two tableviews must be displayed. To do this, I derived the view controller from UIViewController and put the tableviews in that. Now, I derived a customized class from UITableViewController as the delegate and datasource for one of the views. Siince the instance will be released automatically I put a retain member variable as outlet and assign it to the instance of the customized view controller in the xib. The class name for the customized table view controller is assigned correctly too.
But, when I avtivate the view it stops and debugger shows the message:


this class is not key value coding-compliant for the key tableVC.

tableVC is the member variable in the view controller.

Can anybody please help me. I am working on this problem since two days.

Best,
Jamshid2
 

North Bronson

macrumors 6502
Oct 31, 2007
395
1
San José
I think you would be better off with one custom view controller, adding both table views as subviews to that controller's view, and making the controller the delegate and data source of both table views. Don't introduce a UITableViewController subclass; that's for managing one table view.
 

jamshid2

macrumors newbie
Original poster
Nov 13, 2009
6
0
UIViewController as delegate

Hello,

Thank you for your help. It came on that solution because I didn't manage to put a UIViewController as delegate. So maybe it's better to ask you how to do that:

I derive a custon controller from UIViewController and then I declare it as:
MyCustomViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>

and then I implement the necessary methods, namely:

numberOfSectionsInTableView
numberOfRowsInSection
cellForRowAtIndexPath

in MyCustomViewDataSource. Then I put a table view in my xib file. Everything is fine. But as soon as I asign the delegate and datasource in IB to the FileOwner (MyCustomViewController) and open the view the program crashes.
The error message is Debugger console says the message below. I am new to XCode and I do not even know how to use these values.
Can you please help me with that?

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0xd1cf00'
2009-11-23 07:51:12.378 iMatchU[4780:20b] Stack: (
807902715,
2465427003,
808284155,
807854166,
807706786,
816343988,
816351131,
816350151,
815065318,
815008381,
815047328,
815036001,
11787668,
11787093,
11785134,
11784226,
11817696,
807689266,
807686207,
807683624,
839142449,
839142646,
814752238
)
 

jamshid2

macrumors newbie
Original poster
Nov 13, 2009
6
0
UIViewController was not loaded

Hello,

Thank you for your help. The class contained the method. I had done another stupid mistake. Indeed the application I was writing was TabBarController based and for the second Tab I had specified the xib name instead of putting the appropriate UIViewController as the second selection of tab bar controller. Hence, the controller was not loaded at all and the delegate and source could not be assigned to that.

I guess I need more experience to decrypt error messages of the debugger ;)

Best,
Jamshid2
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.