YBIBVideoTopBar.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // YBIBVideoTopBar.m
  3. // YBImageBrowserDemo
  4. //
  5. // Created by 波儿菜 on 2019/7/11.
  6. // Copyright © 2019 杨波. All rights reserved.
  7. //
  8. #import "YBIBVideoTopBar.h"
  9. #import "YBIBIconManager.h"
  10. @interface YBIBVideoTopBar ()
  11. @property (nonatomic, strong) UIButton *cancelButton;
  12. @end
  13. @implementation YBIBVideoTopBar
  14. #pragma mark - life cycle
  15. - (instancetype)initWithFrame:(CGRect)frame {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. [self addSubview:self.cancelButton];
  19. }
  20. return self;
  21. }
  22. - (void)layoutSubviews {
  23. [super layoutSubviews];
  24. CGFloat buttonWidth = 54;
  25. self.cancelButton.frame = CGRectMake(0, 0, buttonWidth, self.bounds.size.height);
  26. }
  27. #pragma mark - public
  28. + (CGFloat)defaultHeight {
  29. return 50;
  30. }
  31. #pragma mark - getter
  32. - (UIButton *)cancelButton {
  33. if (!_cancelButton) {
  34. _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
  35. [_cancelButton setImage:YBIBIconManager.sharedManager.videoCancelImage() forState:UIControlStateNormal];
  36. _cancelButton.layer.shadowColor = UIColor.darkGrayColor.CGColor;
  37. _cancelButton.layer.shadowOffset = CGSizeMake(0, 1);
  38. _cancelButton.layer.shadowOpacity = 1;
  39. _cancelButton.layer.shadowRadius = 4;
  40. }
  41. return _cancelButton;
  42. }
  43. @end