Skip to content

Instantly share code, notes, and snippets.

@azu
Created November 24, 2011 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/1390566 to your computer and use it in GitHub Desktop.
Save azu/1390566 to your computer and use it in GitHub Desktop.
オレオレ属性をボタンなどに追加する
//
// Created by azu on 11/11/10.
#import <Foundation/Foundation.h>
@interface UIControl (oreProperty)
@property(nonatomic, retain) NSString *altAccessibilityHint;
@end
//
// Created by azu on 11/11/10.
#import <objc/runtime.h>
#import "UIControl+oreProperty.h"
@implementation UIControl (oreProperty)
static char UIB_PROPERTY_KEY;
@dynamic altAccessibilityHint;
- (void)setAltAccessibilityHint:(NSString *)value {
objc_setAssociatedObject(self, &UIB_PROPERTY_KEY, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSString *)altAccessibilityHint {
return (NSString *) objc_getAssociatedObject(self, &UIB_PROPERTY_KEY);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment