I’ve got a UITableView that I’d like to stick a 44px subview on top of. I tried tableViewHeader, but that scrolls with the rest of the table.
I tried searching and have found many people saying I need to add a UIView superview and then add my header and the UITableView to it. However I can’t find an example on exactly how to do this. I tried making a new UIView subclass and laying out the subviews in IB, but I ran into trouble getting the table controller to link w/ the UITable (because I don’t know enough about IB).
How can I do this with XIBs? Can someone provide an example?
Thanks for any help you guys can provide.
I finally figured this out right after posting. Figures. 🙂
Here’s what I did, in case others run into the same problem:
Delete the existing
UITableViewControllerand its XIB. They’re junk. Get really mad while you do.Make a new
UIViewControllersubclass with a XIBOpen XIB in IB and add your header stuff and a
UITableViewto theUIViewIn the IB Outlets for
UITableViewmake sure you connect Delegate and DataSource to your File OwnerIn the header for your view controller, be sure to add
<UITableViewDelegate, UITableViewDataSource>to implement these protocolsImplement all the regular
UITableViewdelegate and data source methods you know and love, but in yourUIViewControllerinstead of the way you’re used to doing it throughUITableViewControllerAfter this things should work.