I'd like to add a UIView above the table, as if it's the header.
I don't want to use UITableViewHeader because it doesn't allow auto-layout.
I'd like to add a UIView above the table, as if it's the header.
I don't want to use UITableViewHeader because it doesn't allow auto-layout.
You can change the UITableView's header view to be a custom view, if you like.
Use it's tableHeaderView
property to set it as a custom view. Like so:
tableView.tableHeaderView = YourCustomView()
Or if you don't want to use UITableViewHeader then you can always set tableHeaderView
to nil
and put a custom view above the table view.
You can create a UIView (your header) in your XIB file and set these constraints:
And set these constrains for your UITableView:
If you are creating the UITableView programmatically, you can create these constraints programatically by using the same idea above.
You can create UIView above tableView。as if the tableview's cell.then overwrite scrollViewDidScroll() method and change frame when tableview scrolling.