Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Two TableViews in the one Window - Datasource?? Fritzables Mac Programming 4 Jun 21, 2011 10:46 AM
Showing date from two rows in table view, in two text fields, via bindings Monaj Mac Programming 0 Nov 21, 2010 10:35 PM
Adding two videos in one timeline in Encore CS5 Hassan69 Digital Video 1 Jul 18, 2010 01:28 PM
Detecting intersection of two imageviews in different views drf1229 iPhone/iPad Programming 4 Jan 24, 2010 09:35 PM
What layering software can i get to put two pictures in a sequence? diehardmacfan Digital Photography 3 Jul 21, 2007 01:30 PM


All times are GMT -5. The time now is 09:58 AM.

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

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