123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // YOUPAINIMInputEmoticonButton.m
- // NIMKit
- //
- // Created by chris.
- // Copyright (c) 2015年 NetEase. All rights reserved.
- //
- #import "YOUPAINIMInputEmoticonButton.h"
- #import "UIImage+NIMKit.h"
- #import "YOUPAINIMInputEmoticonManager.h"
- @implementation YOUPAINIMInputEmoticonButton
- + (YOUPAINIMInputEmoticonButton*)youpaificonButtonWithData:(NIMInputEmoticon*)data catalogID:(NSString*)catalogID delegate:( id<NIMEmoticonButtonTouchDelegate>)delegate{
- YOUPAINIMInputEmoticonButton* icon = [[YOUPAINIMInputEmoticonButton alloc] init];
- [icon addTarget:icon action:@selector(youpaifonIconSelected:) forControlEvents:UIControlEventTouchUpInside];
-
- UIImage *image = [UIImage nim_fetchEmoticon:data.filename];
-
- icon.emoticonData = data;
- icon.catalogID = catalogID;
- icon.userInteractionEnabled = YES;
- icon.exclusiveTouch = YES;
- icon.contentMode = UIViewContentModeScaleToFill;
- icon.delegate = delegate;
- [icon setImage:image forState:UIControlStateNormal];
- [icon setImage:image forState:UIControlStateHighlighted];
- return icon;
- }
- - (void)youpaifonIconSelected:(id)sender
- {
- if ([self.delegate respondsToSelector:@selector(selectedEmoticon:catalogID:)])
- {
- [self.delegate selectedEmoticon:self.emoticonData catalogID:self.catalogID];
- }
- }
- @end
|