Created
April 11, 2015 10:32
-
-
Save sdpjswl/5705445b35c19826ae32 to your computer and use it in GitHub Desktop.
Set border and shadow color with runtime attributes on xib / storyboard
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+IBColor.h | |
// FunWithRuntimeAttributes | |
// | |
// Created by Mike Woelmer on 5/13/14. | |
// Copyright (c) 2014 atomicobject. All rights reserved. | |
// | |
@import UIKit; | |
@import QuartzCore; | |
@interface CALayer (IBColor) | |
@property (nonatomic) UIColor *borderIBColor; | |
@property (nonatomic) UIColor *shadowIBColor; | |
@end |
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+IBColor.m | |
// FunWithRuntimeAttributes | |
// | |
// Created by Mike Woelmer on 5/13/14. | |
// Copyright (c) 2014 atomicobject. All rights reserved. | |
// | |
#import "CALayer+IBColor.h" | |
@implementation CALayer (IBColor) | |
- (void)setBorderIBColor:(UIColor *)color { | |
self.borderColor = color.CGColor; | |
} | |
- (UIColor *)borderIBColor { | |
return [UIColor colorWithCGColor:self.borderColor]; | |
} | |
- (void)setShadowIBColor:(UIColor *)color { | |
self.shadowColor = color.CGColor; | |
} | |
- (UIColor *)shadowIBColor { | |
return [UIColor colorWithCGColor:self.shadowColor]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment