如何在iOS中对文本域进行外部阴影效果

时间:2016-07-17 12:41:20

标签: ios uitextview

我期待以下内容: enter image description here

我写了这段代码:

_nameField.layer.cornerRadius = 20;
_nameField.layer.borderWidth = 1;
_nameField.layer.borderColor = [UIColor clearColor].CGColor;

_nameField.layer.shadowColor = [UIColor colorWithRed:118 / 255.0 green:166 / 255.0 blue:239 / 255.0 alpha:0.60].CGColor;
_nameField.layer.masksToBounds = NO;
_nameField.layer.shadowRadius = 3.0f;
_nameField.layer.shadowOpacity = 1.0;
_nameField.layer.shadowOffset = CGSizeMake(0.5, 0.5);

结果是:

enter image description here

如何更改我的代码以存档所需的工作? 感谢。

0 个答案:

没有答案