HJAudioBubbleCell.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // HJAudioBubbleCell.m
  3. // HJAudioBubbleDemo
  4. //
  5. // Created by WHJ on 2017/11/30.
  6. // Copyright © 2017年 WHJ. All rights reserved.
  7. //
  8. #import "HJAudioBubbleCell.h"
  9. #import "HJAudioBubble.h"
  10. @interface HJAudioBubbleCell ()
  11. /** 音频气泡 */
  12. @property (nonatomic, strong) HJAudioBubble *bubble;
  13. @end
  14. #define kScreenW [UIScreen mainScreen].bounds.size.width
  15. #define kScreenH [UIScreen mainScreen].bounds.size.height
  16. static const CGFloat kCellHeight = 80.f;
  17. static const CGFloat kBubbleW = 150.f;
  18. static const CGFloat kBubbleH = 40.f;
  19. @implementation HJAudioBubbleCell
  20. #pragma mark - Life Circle
  21. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  22. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  23. if (self) {
  24. self.selectionStyle = UITableViewCellSelectionStyleNone;
  25. [self setupUI];
  26. }
  27. return self;
  28. }
  29. #pragma mark - About UI
  30. - (void)setupUI{
  31. [self.contentView addSubview:self.bubble];
  32. self.bubble.timeStr = @"50s";
  33. }
  34. #pragma mark - Pravite Method
  35. #pragma mark - Public Method
  36. - (void)showRight:(BOOL)right;{
  37. if (!right) {
  38. self.bubble.frame = CGRectMake(10, 0, kBubbleW, kBubbleH);
  39. }else{
  40. self.bubble.frame = CGRectMake(kScreenW-kBubbleW-10, 0, kBubbleW, kBubbleH);
  41. }
  42. self.bubble.center = CGPointMake(self.bubble.center.x, kCellHeight/2.f);
  43. self.bubble.bubbleShowRight = right;
  44. }
  45. + (CGFloat)backCellHeight{
  46. return kCellHeight;
  47. }
  48. #pragma mark - Event response
  49. #pragma mark - Delegate methods
  50. #pragma mark - Getters/Setters/Lazy
  51. - (HJAudioBubble *)bubble{
  52. if (!_bubble) {
  53. _bubble = [[HJAudioBubble alloc] init];
  54. }
  55. return _bubble;
  56. }
  57. - (void)setLongPressCallBack:(CellBubbleLongPressCallBack)longPressCallBack{
  58. self.bubble.longPressCallBack = longPressCallBack;
  59. }
  60. @end