Created
January 11, 2015 13:00
-
-
Save hashmaparraylist/dc97fcb91d8a7c4d526b to your computer and use it in GitHub Desktop.
UILabel设置border
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
| UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 35)]; | |
| UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, 320, 20)]; | |
| CALayer *bottomBorder = [CALayer layer]; | |
| bottomBorder.frame = CGRectMake(0, 40, 320, .5); | |
| CALayer *rightBorder = [CALayer layer]; | |
| rightBorder.frame = CGRectMake(320, 0, 40, .5); | |
| CALayer *topBorder = [CALayer layer]; | |
| topBorder.frame = CGRectMake(0, 0, 320, .5); | |
| [view.layer addSublayer:bottomBorder]; | |
| [view.layer addSublayer:topBorder]; | |
| [view.layer addSublayer:rightBorder]; | |
| [view.layer addSublayer:label]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment