我有一个UITextView,在其中向框架添加了一些阴影,但是在编写时,文本也具有相同的阴影。如何避免这个问题?
我的代码:
commentary = [[UITextView alloc]initWithFrame:CGRectMake(10, 435, 230, 120)];
commentary.font = STANDARDFONT;
commentary.backgroundColor = BACKGROUND;
commentary.layer.shadowColor = [UIColor blackColor].CGColor;
commentary.layer.shadowOffset = CGSizeMake(2, 2);
commentary.layer.shadowOpacity = 0.8;
commentary.layer.shadowRadius = 2.0;
commentary.layer.borderColor = [UIColor grayColor].CGColor;
commentary.layer.borderWidth = 1.5;
commentary.layer.cornerRadius = 5;
commentary.layer.masksToBounds = NO;
commentary.clipsToBounds = NO;
[self addSubview:commentary];
Background和STANDARDFONT是
[UICOLOR clearColor].CGColor
和[UIFont fontWithName:@"TimesNewRomanPSMT" size:16];
最佳答案
也尝试设置图层背景颜色:commentary.layer.backgroundColor = BACKGROUND.CGColor
关于ios - 将阴影添加到UITextView的框架中,还将阴影添加到文本中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13395968/