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

java - SSE Emitter : Manage timeouts and complete() -

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

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -