NIMSessionUnknowContentView.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // NIMSessionUnknowContentView.h
  3. // NIMKit
  4. //
  5. // Created by chris on 15/3/9.
  6. // Copyright (c) 2015年 Netease. All rights reserved.
  7. //
  8. #import "NIMSessionUnknowContentView.h"
  9. #import "M80AttributedLabel+NIMKit.h"
  10. #import "UIView+NIM.h"
  11. #import "NIMMessageModel.h"
  12. #import "NIMKit.h"
  13. @interface NIMSessionUnknowContentView()
  14. @property (nonatomic,strong) UILabel *label;
  15. @end
  16. @implementation NIMSessionUnknowContentView
  17. -(instancetype)initSessionMessageContentView
  18. {
  19. if (self = [super initSessionMessageContentView]) {
  20. _label = [[UILabel alloc] initWithFrame:CGRectZero];
  21. _label.backgroundColor = [UIColor clearColor];
  22. _label.userInteractionEnabled = NO;
  23. [self addSubview:_label];
  24. }
  25. return self;
  26. }
  27. - (void)refresh:(NIMMessageModel *)data{
  28. [super refresh:data];
  29. NSString *text = @"未知类型消息";
  30. NIMKitSetting *setting = [[NIMKit sharedKit].config setting:data.message];
  31. self.label.textColor = setting.textColor;
  32. self.label.font = setting.font;
  33. [self.label setText:text];
  34. [self.label sizeToFit];
  35. }
  36. - (void)layoutSubviews{
  37. [super layoutSubviews];
  38. _label.nim_centerX = self.nim_width * .5f;
  39. _label.nim_centerY = self.nim_height * .5f;
  40. }
  41. @end