Created
August 31, 2015 16:27
-
-
Save theothertomelliott/a41d22b880226b764cab to your computer and use it in GitHub Desktop.
How to add a border to a UIView programatically. This is extremely handy for debugging view layouts. Example in both Swift and Objective-C.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Objective-C | |
view.layer.borderColor = [UIColor redColor].CGColor; | |
view.layer.borderWidth = 3.0f; | |
// Swift | |
view.layer.borderColor = UIColor.redColor().CGColor; | |
view.layer.borderWidth = 3.0f; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment