MLEmojiLabel.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // MLEmojiLabel.h
  3. // MLEmojiLabel
  4. //
  5. // Created by molon on 5/19/14.
  6. // Copyright (c) 2014 molon. All rights reserved.
  7. //
  8. #import <TTTAttributedLabel/TTTAttributedLabel.h>
  9. typedef NS_OPTIONS(NSUInteger, MLEmojiLabelLinkType) {
  10. MLEmojiLabelLinkTypeURL = 0,
  11. MLEmojiLabelLinkTypeEmail,
  12. MLEmojiLabelLinkTypePhoneNumber,
  13. MLEmojiLabelLinkTypeAt,
  14. MLEmojiLabelLinkTypePoundSign,
  15. };
  16. @class MLEmojiLabel;
  17. @protocol MLEmojiLabelDelegate <TTTAttributedLabelDelegate>
  18. @optional
  19. - (void)mlEmojiLabel:(MLEmojiLabel*)emojiLabel didSelectLink:(NSString*)link withType:(MLEmojiLabelLinkType)type;
  20. @end
  21. @interface MLEmojiLabel : TTTAttributedLabel
  22. @property (nonatomic, assign) BOOL disableEmoji; // 禁用表情
  23. @property (nonatomic, assign) BOOL disableThreeCommon; // 禁用电话,邮箱,连接三者
  24. @property (nonatomic, assign) BOOL isNeedAtAndPoundSign; // 是否需要话题和@功能,默认为不需要
  25. @property (nonatomic, copy) NSString *customEmojiRegex; // 自定义表情正则
  26. @property (nonatomic, copy) NSString *customEmojiPlistName; // xxxxx.plist 格式
  27. @property (nonatomic, copy) NSString *customEmojiBundleName; // 自定义表情图片所存储的bundleName xxxx.bundle格式
  28. @property (nonatomic, strong) UIImage *customEmojiImage; // 自定义表情图片
  29. @property (nonatomic, strong) UIImage *customImage; // 自定义图片
  30. #pragma clang diagnostic push
  31. #pragma clang diagnostic ignored "-Wobjc-property-synthesis"
  32. @property (nonatomic, weak) id<MLEmojiLabelDelegate> delegate; // 点击连接的代理方法
  33. #pragma clang diagnostic pop
  34. @property (nonatomic, copy, readonly) id emojiText; // 外部能获取text的原始副本
  35. - (CGSize)preferredSizeWithMaxWidth:(CGFloat)maxWidth;
  36. @end