how to make a gradient border of UIView?
问题 I want to make a gradient border of view like the following picture: but I don't know how do it exactly , i.e. what the gradient color I should use to do it? how to set my view to show a border like the image? I'm using the following code to get a border: self.view.layer.borderColor = [UIColor orangeColor].CGColor; self.view.layer.borderWidth = 2.0f; 回答1: This what i did and it worked perfectly extension CALayer { func addGradienBorder(colors:[UIColor],width:CGFloat = 1) { let gradientLayer =