ios - Why isn't my UIButton Text changing when I call .setTitle? (Swift) -
i have button changes text of 2 other buttons when pressed. here code:
@ibaction func nextday(sender: anyobject) { selecteddate = selecteddate.set("day", value: selecteddate.day + 1)! //update button text monthdayyearbutton.settitle(formatter.stringfromdate(selecteddate), forstate: .normal) dayoftheweekbutton.settitle(selecteddate.weekdayname, forstate: .normal) } however, dayoftheweekbutton changes title. difference aware between 2 buttons, monthdayyearbutton uses attributed text instead of plain text. used attributed text set font bold.
i have tried every button forstate, including allzeros.
don't worry strange nsdate operations, installed cocoa pod called swiftdate.
try use:
monthdayyearbutton.setattributedtitle(nsattributedstring, forstate: uicontrolstate)
Comments
Post a Comment