Created
August 14, 2013 04:35
-
-
Save mike-anderson/6228041 to your computer and use it in GitHub Desktop.
Allows setting nativeCSS (nativecss.com) id and class as user defined runtime attributes in interface builder.
This file contains 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
#import <UIKit/UIKit.h> | |
#import "UIView+NativeCSS.h" | |
@interface UIView (NativeCSSIBShim) | |
@property (nonatomic,weak) NSString *nativeCSSId; | |
@property (nonatomic,weak) NSString *nativeCSSClass; | |
@end |
This file contains 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
#import "UIView+NativeCSSIBShim.h" | |
@implementation UIView (NativeCSSIBShim) | |
- (void) setNativeCSSClass:(NSString *)CSSClass | |
{ | |
NSArray *classes = [self CSSClasses]; | |
for (NSString *class in classes) { | |
[self removeCSSClass:class]; | |
} | |
classes = [CSSClass componentsSeparatedByString:@" "]; | |
for (NSString *class in classes) { | |
[self addCSSClass:class]; | |
} | |
} | |
- (NSString *) nativeCSSClass | |
{ | |
NSString *classes; | |
for (NSString *class in [self CSSClasses]) { | |
classes = [classes stringByAppendingFormat:@" %@",class ]; | |
} | |
return classes; | |
} | |
- (void) setNativeCSSId:(NSString *)NativeCSSId | |
{ | |
[self setCSSId:NativeCSSId]; | |
} | |
- (NSString *) nativeCSSId | |
{ | |
return [self CSSId]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment