Last active
March 25, 2022 19:29
-
-
Save dtrauger/5722805 to your computer and use it in GitHub Desktop.
Programatically Adding Border to View in 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
CALayer *topBorder = [CALayer layer]; | |
topBorder.frame = CGRectMake(0.0f, 0.0, viewForBorder.frame.size.width, 1.0f); | |
topBorder.borderWidth = 1; | |
topBorder.borderColor = [UIColor colorWithRed:58.0/255.0 green:58.0/255.0 blue:58.0/255.0 alpha:1.0].CGColor; | |
[theView.layer addSublayer:topBorder]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is one of the best, most concise solutions I have found! Thanks a lot! 💯