swift - TableView Section Change Header Alignment -
with default left text alignment change right text alignment . how can ?
edit:
you have in uitableview datasource method viewforheaderinsection
:
swift 2.3:
func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { let headertext = uilabel() headertext.textcolor = uicolor.lightgraycolor() headertext.adjustsfontsizetofitwidth = true switch section{ case 0: headertext.textalignment = .center headertext.text = "this header centered" case 1: headertext.textalignment = .right headertext.text = "this header aligned right" default: headertext.textalignment = .left headertext.text = "default left" } return headertext }
edit: modified code above. can use section
argument identify section want modify.
Comments
Post a Comment