如何在 Swift 中为 UITextView 应用阴影?
How to apply a shadow to a UITextView in Swift?
我尝试像对 UIView
那样对 UITextView
应用阴影,但它不起作用。
试试这个代码:
Obj-C
txtView.layer.cornerRadius = txtView.frame.size.height/2;
txtView.clipsToBounds = NO;
txtView.layer.shadowOpacity=0.4;
txtView.layer.shadowOffset = CGSizeMake(3, 3);
Swift
txtView.layer.cornerRadius = txtView.frame.size.height/2
txtView.clipsToBounds = false
txtView.layer.shadowOpacity=0.4
txtView.layer.shadowOffset = CGSizeMake(3, 3)
希望对你有用。
我尝试像对 UIView
那样对 UITextView
应用阴影,但它不起作用。
试试这个代码:
Obj-C
txtView.layer.cornerRadius = txtView.frame.size.height/2;
txtView.clipsToBounds = NO;
txtView.layer.shadowOpacity=0.4;
txtView.layer.shadowOffset = CGSizeMake(3, 3);
Swift
txtView.layer.cornerRadius = txtView.frame.size.height/2
txtView.clipsToBounds = false
txtView.layer.shadowOpacity=0.4
txtView.layer.shadowOffset = CGSizeMake(3, 3)
希望对你有用。