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

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

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

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