I have created a shadow using QuartzCore
for my UITextView
with this following code.
myTextView.layer.masksToBounds = NO;
myTextView.layer.shadowColor = [UIColor blackColor].CGColor;
myTextView.layer.shadowOpacity = 0.7f;
myTextView.layer.shadowOffset = CGSizeMake(2.0f, 2.0f);
myTextView.layer.shadowRadius = 8.0f;
myTextView.layer.shouldRasterize = YES;
It creates a shadow
and looks good too.
Here it is my output for the above code.
But When I try to add a text to the myTextView
, my textView text goes out of the bounds and it looks outside of the myTextView
like below.
It's happening only when I add shadow. The text inside the textView
is not showing weird If I don't add shadow.What I am doing wrong?? How could I overcome this? Why it is happening?
UPDATE:
@borrrden
said
I found It is happening, because of setting the maskToBounds = NO;
If we set YES
then we cannot get shadow. Reason Here it is an answer