How to add a custom view to top of tableView in UIViewController and be able to scroll together

I'm trying to put a big UIImageView on top of a UITableView inside my UIViewController. I read that I should not put a UITableView inside a UIScrollView and so I'm trying to find out how to best approach this.

Right now, in my UIViewController what I have is a huge UIImageView (covering half of screen) and below that I have my UITableView. The problem is that the scroll only works for the UITableViewCell, but I cannot scroll up so that the image goes to the top and invisible...

Thanks for the help!


Make the tableview the height of the view controller's view then in viewDidLoad say something like:

self.tableView.tableHeaderView = self.imageView

If you're using auto layout you should move the second line to viewsDidLayoutSubviews

Need Your Help

Handling HTTP ContentEncoding "deflate"

java http http-compression content-encoding

What InputStream type should be used to handle URLConnection streams that have HTTP Content-Encoding set to deflate?

Eclipse Error On Startup

eclipse workspace ganymede eclipse-3.4

Eclipse was running fine last night, but this morning I tried starting it up and I came upon this error: