Add title to table in swift

I want to add title to tableview and not to sections in swift.I have a class that is a subclass of UITableViewController. I want to keep a fixed part of the title and scroll to another part.

+3
uitableview scroll swift


source to share


3 answers


This is not how the header works in the table view. You can create a title for an entire table (as opposed to a section title) using the property tableHeaderView

; but if you want to have a widget that is always displayed on the screen, you are better off creating another view controller to which you add the table as a child.



+4


source to share


If you want the title headers and not the section titles, this is the way to do it:



 self.tableView.tableHeaderView = 'your_value' ;// Here goes the UIView for the header

      

+6


source to share


Just drag the shortcut to the TableView in front of the cell, note that you need to drag the shortcut to the TableView, not the cell, and give you a title. this is it. your header is generated by .run and sees the result.

+1


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics