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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -