I wanted to create a subview UIView with round border in iOS. I found following code works very well to draw round border around UIView. While this code is written swift you can easily write similar code in Objective C as well.
Following is the code. As you can see, I selected subview UIView and made is IBOutlet using Interface Builder. Once that is done you can see round border around view.
Following is the code. As you can see, I selected subview UIView and made is IBOutlet using Interface Builder. Once that is done you can see round border around view.
@IBOutlet weak var contentView: UIView? override func viewDidLoad() { super.viewDidLoad(); contentView?.layer.borderWidth = 3.0 contentView?.layer.borderColor = UIColor(red:102/255,green:102/225,blue:102/225, alpha:1).CGColor contentView?.layer.cornerRadius = 14 }And following how it looks.
No comments:
Post a Comment