Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 将阴影添加到UITextView的框架也将阴影添加到文本_Ios_Uitextview_Dropshadow_Quartz Core - Fatal编程技术网

Ios 将阴影添加到UITextView的框架也将阴影添加到文本

Ios 将阴影添加到UITextView的框架也将阴影添加到文本,ios,uitextview,dropshadow,quartz-core,Ios,Uitextview,Dropshadow,Quartz Core,我有一个UITextView,在那里我向框架添加了一些阴影,但是当我写作时,文本也得到了相同的阴影。如何避免这个问题 我的代码: commentary = [[UITextView alloc]initWithFrame:CGRectMake(10, 435, 230, 120)]; commentary.font = STANDARDFONT; commentary.backgroundColor = BACKGROUND; commentary.layer.shadowColor = [UI

我有一个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];

背景和标准字体为
[UICOLOR clearColor].CGColor
[UIFont-fontWithName:@“timesnewromapsmt”大小:16]

同时尝试设置图层背景颜色:
commentation.layer.backgroundColor=background.CGColor

对不起,是我的错。背景色是清晰的,而不是黑色。但是如果我设置
commentation.layer.backgroundColor=[UIColor blackColor]整个uitextview变为黑色。我想要的是框中的文本不带阴影。我还没有找到解决方案,所以我删除了dropshadow。