ios - NSTextAlignmentCenter still not working -


through this question i've learned in order center align text in uilabel via nstextalignmentcenter must disable "letter tighten spacing" , this guy agrees.

they mention disabling option in interface builder, however, uilabel isn't accessible in ib far know. because trying change "textlabel" of cell in uitableview. proceeded attempt try disabling things in code:

cell.textlabel.numberoflines = 1; cell.textlabel.adjustsfontsizetofitwidth      = no; cell.textlabel.adjustsletterspacingtofitwidth = no; cell.textlabel.textalignment = nstextalignmentcenter; cell.textlabel.text = @"my centered text"; 

however, none of these seem have effect. text still left aligned.

found problem! had change cell style uitableviewcellstyledefault:

cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:simpletableidentifier]; 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -