swift - TableView Section Change Header Alignment -


i have tableview here :tableview section header example

with default left text alignment change right text alignment . how can ?

edit:

now looks : how looks now

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

Popular posts from this blog

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

python 2.7 - Lines in my code being skipped and I am not sure why -

python - multiprocessing pool with map -