Skip to content

Instantly share code, notes, and snippets.

@hashmaparraylist
Created January 11, 2015 13:00
Show Gist options
  • Select an option

  • Save hashmaparraylist/dc97fcb91d8a7c4d526b to your computer and use it in GitHub Desktop.

Select an option

Save hashmaparraylist/dc97fcb91d8a7c4d526b to your computer and use it in GitHub Desktop.
UILabel设置border
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