EMMessageBubbleView.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // EMMessageBubbleView.m
  3. // ChatDemo-UI3.0
  4. //
  5. // Created by XieYajie on 2019/1/25.
  6. // Copyright © 2019 XieYajie. All rights reserved.
  7. //
  8. #import "EMMessageBubbleView.h"
  9. @implementation EMMessageBubbleView
  10. - (instancetype)initWithDirection:(EMMessageDirection)aDirection
  11. type:(EMMessageType)aType
  12. {
  13. self = [super init];
  14. if (self) {
  15. _direction = aDirection;
  16. _type = aType;
  17. }
  18. return self;
  19. }
  20. - (void)setupBubbleBackgroundImage
  21. {
  22. if (self.direction == EMMessageDirectionSend) {
  23. self.image = [[UIImage imageNamed:@"msg_bg_send"] stretchableImageWithLeftCapWidth:15 topCapHeight:30];
  24. } else {
  25. self.image = [[UIImage imageNamed:@"msg_bg_recv"] stretchableImageWithLeftCapWidth:15 topCapHeight:30];
  26. }
  27. }
  28. - (void)setupAppBackgroundImage
  29. {
  30. if (self.direction == EMMessageDirectionSend) {
  31. self.image = [[UIImage imageNamed:@"msg_bg_app"] stretchableImageWithLeftCapWidth:15 topCapHeight:30];
  32. } else {
  33. self.image = [[UIImage imageNamed:@"msg_bg_recv"] stretchableImageWithLeftCapWidth:15 topCapHeight:30];
  34. }
  35. }
  36. @end