Created
November 6, 2012 19:48
-
-
Save setoh2000/4027038 to your computer and use it in GitHub Desktop.
Viewの周りに余白(margin)を付けて枠線を付ける
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
CGFloat margin = 3.0; | |
CGFloat w = aView.bounds.size.width; | |
CGFloat h = aView.bounds.size.height; | |
CALayer *borderLayer = [CALayer layer]; | |
borderLayer.borderColor = [UIColor lightGrayColor].CGColor; | |
borderLayer.borderWidth = 1; | |
borderLayer.frame = CGRectMake(-margin, -margin, w + margin * 2, h + margin * 2); | |
[aView.layer addSublayer:borderLayer]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment