ios - shadow in UILabel -


i tried subclassing uilabel following code.. unable similar label dropshadow

- (void) drawrect:(cgrect)rect {     cgsize myshadowoffset = cgsizemake(4, -4);     cgfloat mycolorvalues[] = {0, 0, 0, .8};      cgcontextref mycontext = uigraphicsgetcurrentcontext();     cgcontextsavegstate(mycontext);      cgcolorspaceref mycolorspace = cgcolorspacecreatedevicergb();     cgcolorref mycolor = cgcolorcreate(mycolorspace, mycolorvalues);     cgcontextsetshadowwithcolor (mycontext, myshadowoffset, 5, mycolor);      self.layer.shadowoffset = cgsizemake(0, 1);     self.layer.shadowopacity = 0.5;     self.shadowcolor = [uicolor blackcolor];      [super drawtextinrect:rect];      cgcolorrelease(mycolor);     cgcolorspacerelease(mycolorspace);      cgcontextrestoregstate(mycontext); } 

self.layer.shadowoffset = cgsizemake(0, -2.5); self.layer.shadowradius = 1; self.layer.shadowopacity = 0.5; self.layer.shadowcolor = [uicolor blackcolor].cgcolor; 

here output


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -