|
1
2
3
4
5
|
@interface UIImageView (image)
- (void)speak:(NSString *)words;
@end
|
|
1
2
3
4
5
6
7
|
@implementation UIImageView (image)
- (void)speak:(NSString *)words
{
NSLog(@"%@",words);
}
@end
|
|
1
2
3
4
5
|
@interface UIImageView (title)
@property (nonatomic, strong) NSString *title;
@end
|
|
1
2
3
4
5
6
7
8
9
10
11
|
@implementation UIImageView (title)
static void * MyKey = (void *)@"MyKey";
- (NSString *)title
{
return objc_getAssociatedObject(self, MyKey);
}
- (void) setTitle:(NSString *)title
{
objc_setAssociatedObject(self, MyKey, title, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
@end
|