Nesting a TableView in a NavigationView in A TabBarView
I am having a horrible time trying to get this to work.
I've implemented the table in iPhone Noobs 'Click a Cell' guide and am now trying to figure out how I can get that working within a Tab Bar.
From what I've read, it looks like I need to nest a Navigation Controller within a Tab Bar Controller. Is this right?
Everything works great, except when I try to click a cell, I get an ugly error:
Quote:
[Session started at 2008-10-22 13:21:05 -0400.]
2008-10-22 13:21:05.622 test234[20029:20b] *** -[NSCFArray objectForKey:]: unrecognized selector sent to instance 0x44cdf0
2008-10-22 13:21:05.623 test234[20029:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray objectForKey:]: unrecognized selector sent to instance 0x44cdf0'
2008-10-22 13:21:05.624 test234[20029:20b] Stack: (
2473791819,
2488942139,
2473821002,
2473814348,
2473814546,
28501,
816648952,
816663775,
816672452,
816674377,
816673653,
9639,
816434578,
816463537,
816274443,
816209415,
816206378,
829003042,
829012108,
2473293333,
2473295096,
829005112,
829005309,
816175835,
816221412,
8196
)
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found).
warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory).
Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/kevinowocki/Library/Application Support/iPhone Simulator/User/Applications/3C89B470-CF49-48B7-82B1-A01A9FBDB74D/test234.app/test234', process 20029.
Here is my code for pushing the detailed view when a cell in my table is clicked :
Really? Any thoughts on why you can do it in code, but not in IB?
I'm really hoping to use IB to create this functionality. The entire project is built around the interface in IB, so I'd rather not reorganize just for this.
Have a look at TabBarController - Navigation Controller - TableView thread and I have dealt with it completely.
There are rather simple ways to do this actually, even in IB.
In IB, just create your table View controller class. Add a navigationcontroller to MainWindow. Drop the ViewController in the Navigation Controller. Now: add a Tab Bar Controller (easier just to use the original TabBar app base), open it, and drag the navigation controller into the TAB BAR AT THE BOTTOM of view Controller. A new icon will pop up, and you will have created it. It doesn't quite work like other view controllers, its actually much simpler.
Have a look at TabBarController - Navigation Controller - TableView thread and I have dealt with it completely.
There are rather simple ways to do this actually, even in IB.
In IB, just create your table View controller class. Add a navigationcontroller to MainWindow. Drop the ViewController in the Navigation Controller. Now: add a Tab Bar Controller (easier just to use the original TabBar app base), open it, and drag the navigation controller into the TAB BAR AT THE BOTTOM of view Controller. A new icon will pop up, and you will have created it. It doesn't quite work like other view controllers, its actually much simpler.
I'm sorry. To be honest, I'm not following you. Especially that last paragraph. I understand how to use IB to nest the TableViewController inside the NavigationController inside the TabBarController.
What I can't figure out is why I am greeted with a nasty stack trace (see OP) whenever I click on a cell inside of that nested TableView.
Some code is sending objectForKey, an NSDictionary method, to a NSCFArray object.
It was the 'viewDidLoad' method in the view I was calling. Thanks for converting that 'console speak' to plain English. I never would have considered looking there if it weren't for that.
DevTeamofOne, PhoneyDeveloper, and hijinks, thanks so much for your help!
One more thing, look at my comments about gdbinit in the below thread. You can set a breakpoint so that your code breaks when the runtime exception is going to be thrown and you can look at the stack and see exactly what line of your code is causing the failure.