Reputation: 1220
I want to add header to tableview & not to sections in swift.I have class which is sub class of UITableViewController. I want to keep header part fixed & other part scrollable.
Upvotes: 5
Views: 19743
Reputation: 891
Just drag a label on TableView before the cell ,note that you have to drag label on TableView not in cell and give you title . thats it . your header is created .run and see the result .
Upvotes: 0
Reputation: 284
If you want the Header and not section headers than this is the way to do it:
self.tableView.tableHeaderView = 'your_value' ;// Here goes the UIView for the header
Upvotes: 13
Reputation: 24040
That's not how the header works in a table view. You can create a header for the whole table (as opposed to a per-section title) using the tableHeaderView
property; but if you want to have a widget that is always displayed on screen you're better off creating another view controller to which you add the table as a child view.
Upvotes: 5