objective c - NSAttributedString drop shadow is cropping on descenders -
i using nsmutableattributedstring
in ios6 apply kerning , drop shadows within uilabel
subclass. attributes being applied properly, drop shadow cropping @ at left edge of first character , bottom of descenders ( lowercase p example ). label has clipstobounds
disabled.
the code...
nsmutableattributedstring *attributedstring = [[nsmutableattributedstring alloc] initwithstring:[self text]]; nsrange range = nsmakerange(0, [attributedstring length]); nsnumber *kern = [nsnumber numberwithfloat:0.75f]; [attributedstring addattribute:nskernattributename value:kern range:range]; nsshadow *shadow = [[nsshadow alloc] init]; [shadow setshadowblurradius:3.0f]; [shadow setshadowcolor:[uicolor darkgraycolor]]; [shadow setshadowoffset:cgsizemake(0, 2.0f)]; [attributedstring addattribute:nsshadowattributename value:shadow range:range]; [self setattributedtext:attributedstring];
its barely noticeable, once see it, it's obvious. have others encountered bug , there work-around?
Comments
Post a Comment