Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 22, 2009, 01:21 PM   #1
jamshid2
macrumors newbie
 
Join Date: Nov 2009
Putting two tableviews in one view

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
jamshid2 is offline   0 Reply With Quote
Old Nov 22, 2009, 11:24 PM   #2
North Bronson
macrumors 6502
 
Join Date: Oct 2007
Location: Los Angeles
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.
__________________
North Bronson Software
North Bronson is offline   0 Reply With Quote
Old Nov 23, 2009, 01:02 AM   #3
jamshid2
Thread Starter
macrumors newbie
 
Join Date: Nov 2009
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 is offline   0 Reply With Quote
Old Nov 23, 2009, 02:37 AM   #4
Troglodyte
macrumors member
 
Join Date: Jul 2009
Quote:
Originally Posted by jamshid2 View Post
-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0xd1cf00'
This is the important bit. It means your class does not have a required method .
Troglodyte is offline   0 Reply With Quote
Old Nov 23, 2009, 03:00 AM   #5
jamshid2
Thread Starter
macrumors newbie
 
Join Date: Nov 2009
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
jamshid2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad: Multiple predicates in various tableviews jsanto iPad 0 Feb 11, 2013 04:16 PM
font in tableviews LARRYSE iPhone/iPad Programming 6 Nov 13, 2012 08:27 AM
Pushing to a Detail View from a Table View Cell using Xcode Storyboard xcodeApp10 iPhone/iPad Programming 2 Sep 17, 2012 03:45 PM
Difference between a cell and a row in Tableviews? animefx iPhone/iPad Programming 4 Aug 7, 2012 02:35 PM
Two TableViews in a single ViewController ?? Fritzables iPhone/iPad Programming 2 Jul 8, 2012 07:25 PM

Forum Jump

All times are GMT -5. The time now is 12:51 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC