Skip to content

Instantly share code, notes, and snippets.

@theothertomelliott
Created August 31, 2015 16:27
Show Gist options
  • Save theothertomelliott/a41d22b880226b764cab to your computer and use it in GitHub Desktop.
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.
// 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