In my iOS app, I am trying to add shadows to a UITextView
using QuartzCore, but I end up with text scrolling outside of the bounds of the UITextView
:
I have tried to use the solutions at Text scrolls outside of the UITextView box boundary, however none of the solutions worked. The first solution, textView.contentInset = UIEdgeInsetsZero;
, does absolutely nothing to the UITextView
when I place it in the viewDidLoad
method. The second solution gets rid of the shadow that I'm trying to add: [textView setClipsToBounds:YES];
.
Here is the Quartz Core code I'm using to create the shadow:
textView.layer.masksToBounds = NO;
textView.layer.shadowOffset = CGSizeMake(-1, 1);
textView.layer.shadowRadius = 3;
textView.layer.shadowOpacity = 0.3;
What am I doing wrong? Is this a bug in iOS? If so, are there any workarounds or solutions?