12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #import "WFCUNewFriendTableViewCell.h"
- #import <WFChatClient/WFCChatClient.h>
- #import "SDWebImage.h"
- @interface WFCUNewFriendTableViewCell ()
- @end
- @implementation WFCUNewFriendTableViewCell
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- }
- - (void)onFriendRequestUpdated:(NSNotification *)notification {
- [self updateBubbleNumber];
- }
- - (void)updateBubbleNumber {
- int unreadCount = [[WFCCIMService sharedWFCIMService] getUnreadFriendRequestStatus];
- if (unreadCount) {
- self.bubbleView.hidden = NO;
- [self.bubbleView setBubbleTipNumber:unreadCount];
- } else {
- self.bubbleView.hidden = YES;
- }
- }
- - (void)refresh {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFriendRequestUpdated:) name:kFriendRequestUpdated object:nil];
-
- [self updateBubbleNumber];
- }
- - (BubbleTipView *)bubbleView {
- if (!_bubbleView) {
- if (self.portraitView) {
- _bubbleView = [[BubbleTipView alloc] initWithParentView:self.contentView];
- _bubbleView.hidden = YES;
- }
- }
- return _bubbleView;
- }
- - (UIImageView *)portraitView {
- if (!_portraitView) {
- _portraitView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 36, 36)];
- _portraitView.layer.masksToBounds = YES;
- _portraitView.layer.cornerRadius = 3.f;
- [self.contentView addSubview:_portraitView];
- }
- return _portraitView;
- }
- - (UILabel *)nameLabel {
- if (!_nameLabel) {
- _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(56, 19, [UIScreen mainScreen].bounds.size.width - 64, 16)];
- _nameLabel.font = [UIFont systemFontOfSize:16];
- [self.contentView addSubview:_nameLabel];
- }
- return _nameLabel;
- }
- - (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- @end
|