shadow - (iphone) i'm getting black rectangle behind image, why? -
i have uiimageview subclass instance has multiple image sublayers.
i want add/remove shadow dynamically view.
the following code works fine(imageview subclass's implementation) imageview 1 sublayer, shows black rectangle instead of shadow imageview multiple sublayers.
(actually, 1 layer image, code seems keep adding shadow on top of previous shadow if run multiple times, minor problem)
- (void) drawlayer: (calayer*) layer incontext: (cgcontextref)context { syslog(log_debug, "in drawlayer, isshadowed: %d", isshadowed); if(isshadowed == true) { cgcontextsavegstate(context); cgcontextclearrect(context, self.bounds); cgcontextsetshadow(context, cgsizemake(10, 10), 3); cgcontextbegintransparencylayer(context, null); [layer renderincontext:context]; cgcontextendtransparencylayer(context); cgcontextrestoregstate(context); } else { [layer renderincontext:context]; } }
thank you
if layer's opaque
not no, cgcontextclearrect paints black rather punching transparent hole in layer. i'm guessing that's problem.
Comments
Post a Comment