With Swift and Xcode 6 you can do it.
Click the UIView element in the Storyboard and go to the identity inspector. In custom runtime attributes, type:
layer.borderWidth number 1
If you need beautiful angles
layer.cornerRadius number 5 layer.masksToBounds boolean true
Now this will give you a border, but to set the color you need to do this with code. Go to your view controller and add an IBOutlet from your UIView. Say what you do
@IBOutlet weak var xView: UIView!
Call this in the viewDidLoad function as shown below to set the color.
xView.layer.borderColor = UIColor.whiteColor().CGColor
Thank!
Migel Tissera Feb 01 '15 at 4:46 2015-02-01 04:46
source share