View Swapping with TableCellViews


#1

I’m trying to add View Swapping as described in chapter 31 using Table Cell Views instead of Table Views. Also, I am not using Core Data, but just an NSMutableArray. Basic setup is:
[ul]
[li]Display a list of Lists in a Table View using Table Cell View tied to an ArrayController[/li]
[li]Select a List, which may have categories or actual List Items[/li]
[li]If List Items, swap in the List Items View Controller and populate the ArrayController’s NSMutableArray[/li][/ul]
I have already had the display of the list of Lists and the selection of a List with List Items properly populating a second Table View using a Table Cell View working. I refactored to to use the View Swapping, creating a stand alone ViewController to display a List’s Items. The View Controller has a Scroll View -> Table View -> Table Cell View and an ArrayController.

When I run, I see the correct number of items, but no content (just the default values for each part). Debugging shows that the ArrayController, tied to the View Controller via an IBOUTLET is always nil.

Is there something I’m missing to use array data instead of Core Data to work with the View Swapping? I can suply code upon request.

Please help.

Greg Walters


#2

It is hard to say from a distance, but If I were you I would investigate the [color=#FF0000]nil[/color] first.


#3

The problem was in the swap view xib I set up. I had a custom view (used as a background) and a scroll view in my original configuration. When I split that out, I made the custom view the top level view and added the scroll view as a child.

I changed the top level view in the xib to an NSView and added the custom background view as a sibling to the scroll view (as I had it in the original configuration) and everything worked properly.