简体   繁体   中英

Make a UIView with a blurred view as borderColor

I need to create a UIView with a blurred view as borderColor .

How can I get that to work?

I have attached a sample image as an example of my requirement. 在此处输入图片说明

Thanks

I don't think the border of a UITextField has a fading property, or anything similar. However, with a bit of work, you can accomplish what you need:

1) Download/acquire a background image that has the border you want. It can be rectangular. Add it to your project. 2) In IB, set the BorderStyle of you TextView to None, the BackgroundImage to the image you added, and add an outlet to your UIViewController class. 3) Add the following code to your viewDidLoad. Replace with the name of your IBOutlet:

<textField>.layer.cornerRadius =5.0

This should give you a UITextField with rounded corners and your background image. You may have to play around with your image and the cornerRadius values to get exactly what you want, but the code should work.

Use my code its work perfectly. Textviewview is my One UIView and inside it one textfield and one UIImageview i use.

Textviewview.layer.cornerRadius = 25.0
Textviewview.layer.shadowColor = UIColor(white: 0.0, alpha: 0.5).CGColor
Textviewview.layer.shadowOffset = CGSizeMake(0.0, 0.0)
Textviewview.layer.shadowOpacity = 1.0
Textviewview.layer.shadowRadius = 6.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM