EMMsgLocationBubbleView.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // EMMsgLocationBubbleView.m
  3. // ChatDemo-UI3.0
  4. //
  5. // Created by XieYajie on 2019/2/14.
  6. // Copyright © 2019 XieYajie. All rights reserved.
  7. //
  8. #import "EMMsgLocationBubbleView.h"
  9. @implementation EMMsgLocationBubbleView
  10. - (instancetype)initWithDirection:(EMMessageDirection)aDirection
  11. type:(EMMessageType)aType
  12. {
  13. self = [super initWithDirection:aDirection type:aType];
  14. if (self) {
  15. if (self.direction == EMMessageDirectionSend) {
  16. self.iconView.image = [UIImage imageNamed:@"msg_location_white"];
  17. } else {
  18. self.iconView.image = [UIImage imageNamed:@"msg_location"];
  19. }
  20. }
  21. return self;
  22. }
  23. #pragma mark - Setter
  24. - (void)setModel:(EMMessageModel *)model
  25. {
  26. EMMessageType type = model.type;
  27. if (type == EMMessageTypeLocation) {
  28. EMLocationMessageBody *body = (EMLocationMessageBody *)model.emModel.body;
  29. self.textLabel.text = body.address;
  30. self.detailLabel.text = [NSString stringWithFormat:@"纬度:%.2lf°, 经度:%.2lf°", body.latitude, body.longitude];
  31. }
  32. }
  33. @end