Sin descripción

FKPullPageTopView.m 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // FKPullPageTopView.m
  3. // FirstLink
  4. //
  5. // Created by jack on 16/8/11.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKPullPageTopView.h"
  9. @interface FKPullPageTopView ()
  10. @property (nonatomic, strong) UIImageView *arrowView;
  11. @property (nonatomic, strong) UILabel *titleLabel;
  12. @end
  13. @implementation FKPullPageTopView
  14. - (instancetype)initWithFrame:(CGRect)frame{
  15. if (self = [super initWithFrame:frame]) {
  16. [self addAllSubviews];
  17. }
  18. return self;
  19. }
  20. - (void)addAllSubviews{
  21. [self addSubview:self.arrowView];
  22. [self addSubview:self.titleLabel];
  23. }
  24. - (void)resetLayoutSubViews{
  25. // 重新布局
  26. CGFloat height = CGRectGetHeight(self.bounds);
  27. CGFloat width = CGRectGetWidth(self.bounds);
  28. if (!height || !width) return;
  29. self.titleLabel.center = CGPointMake(width / 2.0f, CGRectGetMaxY(self.bounds) - 30);
  30. self.titleLabel.bounds = CGRectMake(0, 0, self.titleLabel.intrinsicContentSize.width, self.titleLabel.intrinsicContentSize.height);
  31. self.arrowView.center = CGPointMake(CGRectGetMinX(self.titleLabel.frame) - 30, self.titleLabel.center.y);
  32. //
  33. // CGFloat circleMargin = RefreshAnimMargin + RefreshCircleLineW + 2;
  34. //
  35. // self.imageView.center = CGPointMake(width / 2.0f, CGRectGetMaxY(self.bounds) - 30);
  36. // self.circleView.center = self.imageView.center;
  37. // self.circleView.bounds = CGRectMake(0, 0, circleMargin, circleMargin);
  38. }
  39. - (void)startRefreshing{
  40. self.titleLabel.text = @"释放返回商品详情";
  41. }
  42. - (void)finishRefreshing{
  43. self.titleLabel.text = @"下拉返回商品详情";
  44. }
  45. // 松开可刷新
  46. - (void)canEngageRefreshWithOffsetY:(CGFloat)y{
  47. self.titleLabel.text = @"释放返回商品详情";
  48. }
  49. // 下拉过程
  50. - (void)didDisengageRefreshWithOffsetY:(CGFloat)y{
  51. self.titleLabel.text = @"下拉返回商品详情";
  52. }
  53. #pragma mark - property
  54. - (UIImageView *)arrowView{
  55. if (_arrowView == nil) {
  56. _arrowView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"up_arrow"]];
  57. }
  58. return _arrowView;
  59. }
  60. - (UILabel *)titleLabel{
  61. if (_titleLabel == nil) {
  62. _titleLabel = [[UILabel alloc]init];
  63. _titleLabel.font = [UIFont systemFontOfSize:13];
  64. _titleLabel.textColor = UIColorFromRGB(0x666666);
  65. _titleLabel.text = @"下拉返回商品详情";
  66. }
  67. return _titleLabel;
  68. }
  69. @end