Storyboard mode with Homepwner


#1

hello,
i’ve been working my way through this book while using the storyboard mode. i’ve been figuring things out fairly easily after studying the XIB way and applying it with the storyboard. in a couple of cases, i built 2 versions of each app. i’ve finally hit a stumbling block in this chapter.

i started with a single view storyboard, deleted it and replaced with a table view controller. set the class of that table view controller to my ItemsViewController. i was able to get it all working and complete chapter 10, …even the challenge section.

so, now i’m trying to add a view with buttons. since dragging a UIView onto the storyboard table view wouldn’t work (would not drop), …i drug it over past the story board and dropped it in the tree control under ItemsViewController->TableView. so, i have a UIView on the same level as Table View Cell. i changed it’s class to ItemsViewController, added two buttons to it, made the UIView transparent, connected button events to Toggle Edit mode and Add New Possession functions.

but, when i run it, i don’t see the UIView and buttons in the header. i assume b/c i haven’t performed logic similar to the “Load Nib Named” NSBundle section. but, i dont know exactly what to do.

any help would be appreciated. i can’t wait for your next book that covers this. i’m really enjoying everything so far.
best,
scott


#2

follow up question:

does the Table View Controller assume full screen ?

i’m thinking i need to back up, remove the Table View Controller, add a regular UI View Controller, and then add a 2 buttons and Table View as subviews. then i’ll probably have to manage the data source, delegate, etc without a TableViewController. is this the correct path ?


#3

I am/was very interested in the ‘best’ way to do this myself. However, I found that I could just follow the book as is: (recap)

Create an empty Interface code file, (empty XIB) and set its owner to ItemsViewController. Drag a UIView onto the canvas, add buttons and wire up. You don’t have to write the code for the outlets and action, you can use ctrl+drag to the ItemsViewController header, the code will be generated.

Implement the headerView getter to manually load the Nib

Implement the tableView:viewForHeaderInSection: and tableView:heightForHeaderInSection methods and it just works.

Having spent a couple hours searching the web and stackoverflow.com I’ve come to the conclusion that this continues to be the way to implement custom headers and footers for sections in the context of a storyboard. For table header and footer you can just drag a UIView into the document outline above and below the tableViewCell(s) under the Table View node in the tree.


#4

[quote=“blackeyed28”]
so, now i’m trying to add a view with buttons. since dragging a UIView onto the storyboard table view wouldn’t work (would not drop), …i drug it over past the story board and dropped it in the tree control under ItemsViewController->TableView. so, i have a UIView on the same level as Table View Cell. i changed it’s class to ItemsViewController, added two buttons to it, made the UIView transparent, connected button events to Toggle Edit mode and Add New Possession functions.

but, when i run it, i don’t see the UIView and buttons in the header. i assume b/c i haven’t performed logic similar to the “Load Nib Named” NSBundle section. but, i dont know exactly what to do.[/quote]

What you did is create a Table Header, not a Section Header. It should have worked though, it has for me. Perhaps you set the transparency on the wrong thing?

I just did it to confirm. It works. I just dragged a UIView to the document outline, its at the same level as the Table View Cell. Dragged a button onto the View, put ‘Hello’ on it. Set the background of the View to transparent and ran the app. Works fine.

For myself I’m experimenting as I need to use both table and section headers and footers.