iphone - using an alternative UILabel within a UIButton -
this first question on message board please go easy on me :)
a while ago came across useful piece of code change uilabel, surounds text in label black (or other color) outline.
- (void)drawtextinrect:(cgrect)rect; { cgsize shadowoffset = self.shadowoffset; uicolor *textcolor = self.textcolor; cgcontextref c = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(c, 2); cgcontextsetlinejoin(c, kcglinejoinround); cgcontextsettextdrawingmode(c, kcgtextstroke); self.textcolor = [uicolor blackcolor]; [super drawtextinrect:rect]; cgcontextsettextdrawingmode(c, kcgtextfill); self.textcolor = textcolor; self.shadowoffset = cgsizemake(0, 0); [super drawtextinrect:rect]; self.shadowoffset = shadowoffset; }
i used template subclass uilabels, , have fair understanding on subclassing.
what use subclass uilabel part of uibutton text within buttons have matching black outline.
any or being pointed in right direction appreciated.
thanks
dave
why not subclass uibutton
, , within subclass make same changes made in uilabel
subclass button's label property. exact same way, except of changes refer self.titlelabel
instead of self
.
Comments
Post a Comment