Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz based drop shadows don't work for me on UITextView

I have been able to add shadows to many UI objects in my view, including rather nicely drop shadowing some custom drawing in a UIImageView. However the same code produces nothing when applied to a UITextView:

[desc.layer setShadowColor:[[UIColor blackColor] CGColor]];
[desc.layer setShadowRadius:2.0f];
[desc.layer setShadowOffset:CGSizeMake(1, 1)];
[desc.layer setShadowOpacity:0.8f];

Is this something I'm missing? I was hoping to use quartz to add a border and a drop shadow. The border code does work when commented in:

//Border.
/*
[desc.layer setBackgroundColor:[[KookaSettings sharedInstance].cellBackgroundColorD CGColor]];
[desc.layer setBorderColor: [[UIColor blackColor] CGColor]];
[desc.layer setBorderWidth:1.0f];
[desc.layer setCornerRadius:8.0f];
*/
like image 985
Diziet Avatar asked Dec 13 '22 17:12

Diziet


1 Answers

I know that the drop shadow doesn't work if the view has clipsToBounds set. Perhaps UITextView has that set by default?

like image 95
filipe Avatar answered Dec 30 '22 03:12

filipe