How to apply text shadow to UITextView?

dontWatchMyProfile picture dontWatchMyProfile · May 17, 2010 · Viewed 21.6k times · Source

Actually I love UILabel. They're sweet. Now I had to go to UITextView because UILabel is not aligning text vertically to the top. Damn. One thing I really need is a text shadow. UILabel has it. UITextView seems to not have it. But I guess that guy just uses the same underlying UIKit NSString additions?? Maybe someone already has a solution for that problem? What would I overwrite?

Answer

adjwilli picture adjwilli · May 9, 2011
text.layer.shadowColor = [[UIColor whiteColor] CGColor];
text.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
text.layer.shadowOpacity = 1.0f;
text.layer.shadowRadius = 1.0f;

And don't forget to add up top:

#import <QuartzCore/QuartzCore.h>