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.imageView.removeFromSuperView() self.tableView.tableHeaderView = self.imageView
If you're using auto layout you should move the second line to viewsDidLayoutSubviews