ios4 - uilabel with outline or stroke -


this question has answer here:

i wondering how can create text stroke uilabel ? there possible way ? enter image description here

thank ,

#import <foundation/foundation.h>   @interface customlabel : uilabel {   }   @end  #import "customlabel.h"   @implementation customlabel  - (void)drawtextinrect:(cgrect)rect {      cgsize shadowoffset = self.shadowoffset;     uicolor *textcolor = self.textcolor;      cgcontextref c = uigraphicsgetcurrentcontext();     cgcontextsetlinewidth(c, 22);      cgcontextsettextdrawingmode(c, kcgtextstroke);     self.textcolor = [uicolor whitecolor];     [super drawtextinrect:rect];      cgcontextsettextdrawingmode(c, kcgtextfill);     self.textcolor = textcolor;     self.shadowoffset = cgsizemake(0, 0);     [super drawtextinrect:rect];      self.shadowoffset = shadowoffset;     //works fine no warning  }    

now question how can use subclass iboutlet label on different viewcontrollers . right :

    label = [[customlabel alloc] initwithframe:cgrectmake(0, 0, 190, 190)]; 

it may helpful add depending on font , characters, adding:

cgcontextsetlinejoin(c,kcglinejoinround); 

can prevent artifacts large stroke applied sharp character.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -