NIMTipContentConfig.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // NIMTipContentConfig.m
  3. // NIMKit
  4. //
  5. // Created by chris on 16/1/21.
  6. // Copyright © 2016年 NetEase. All rights reserved.
  7. //
  8. #import "NIMTipContentConfig.h"
  9. #import "NIMKitUtil.h"
  10. #import "NIMKit.h"
  11. @implementation NIMTipContentConfig
  12. - (CGSize)contentSize:(CGFloat)cellWidth message:(NIMMessage *)message
  13. {
  14. CGFloat messageWidth = cellWidth;
  15. UILabel *label = [[UILabel alloc] init];
  16. label.text = message.text;
  17. label.font = [[NIMKit sharedKit].config setting:message].font;
  18. label.numberOfLines = 0;
  19. CGFloat padding = [NIMKit sharedKit].config.maxNotificationTipPadding;
  20. CGSize size = [label sizeThatFits:CGSizeMake(cellWidth - 2 * padding, CGFLOAT_MAX)];
  21. CGFloat cellPadding = 11.f;
  22. CGSize contentSize = CGSizeMake(messageWidth, size.height + 2 * cellPadding);;
  23. return contentSize;
  24. }
  25. - (NSString *)cellContent:(NIMMessage *)message
  26. {
  27. return @"NIMSessionNotificationContentView";
  28. }
  29. - (UIEdgeInsets)contentViewInsets:(NIMMessage *)message
  30. {
  31. return [[NIMKit sharedKit].config setting:message].contentInsets;
  32. }
  33. @end