TUIVideoReplyQuoteView.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // TUIVideoReplyQuoteView.m
  3. // TUIChat
  4. //
  5. // Created by harvy on 2021/11/25.
  6. // Copyright © 2023 Tencent. All rights reserved.
  7. //
  8. #import <TIMCommon/TIMDefine.h>
  9. #import <TUICore/TUIDarkModel.h>
  10. #import "TUIVideoReplyQuoteView.h"
  11. #import "TUIVideoReplyQuoteViewData.h"
  12. @implementation TUIVideoReplyQuoteView
  13. - (instancetype)initWithFrame:(CGRect)frame {
  14. if (self = [super initWithFrame:frame]) {
  15. _playView = [[UIImageView alloc] init];
  16. _playView.image = TUIChatCommonBundleImage(@"play_normal");
  17. _playView.frame = CGRectMake(0, 0, 30, 30);
  18. [self addSubview:_playView];
  19. }
  20. return self;
  21. }
  22. - (void)layoutSubviews {
  23. [super layoutSubviews];
  24. }
  25. + (BOOL)requiresConstraintBasedLayout {
  26. return YES;
  27. }
  28. // this is Apple's recommended place for adding/updating constraints
  29. - (void)updateConstraints {
  30. [super updateConstraints];
  31. TUIVideoReplyQuoteViewData *myData = (TUIVideoReplyQuoteViewData *)self.data;
  32. [self.imageView mas_remakeConstraints:^(MASConstraintMaker *make) {
  33. make.leading.top.mas_equalTo(self);
  34. if (CGSizeEqualToSize(CGSizeZero, myData.imageSize)) {
  35. make.size.mas_equalTo(CGSizeMake(60, 60));
  36. }
  37. else {
  38. make.size.mas_equalTo(myData.imageSize);
  39. }
  40. }];
  41. [self.playView mas_remakeConstraints:^(MASConstraintMaker *make) {
  42. make.size.mas_equalTo(CGSizeMake(30, 30));
  43. make.center.mas_equalTo(self.imageView);
  44. }];
  45. }
  46. - (void)fillWithData:(TUIReplyQuoteViewData *)data {
  47. //TUIImageReplyQuoteView deal Image
  48. [super fillWithData:data];
  49. }
  50. @end