// // FKPullPageTopView.m // FirstLink // // Created by jack on 16/8/11. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKPullPageTopView.h" @interface FKPullPageTopView () @property (nonatomic, strong) UIImageView *arrowView; @property (nonatomic, strong) UILabel *titleLabel; @end @implementation FKPullPageTopView - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self addAllSubviews]; } return self; } - (void)addAllSubviews{ [self addSubview:self.arrowView]; [self addSubview:self.titleLabel]; } - (void)resetLayoutSubViews{ // 重新布局 CGFloat height = CGRectGetHeight(self.bounds); CGFloat width = CGRectGetWidth(self.bounds); if (!height || !width) return; self.titleLabel.center = CGPointMake(width / 2.0f, CGRectGetMaxY(self.bounds) - 30); self.titleLabel.bounds = CGRectMake(0, 0, self.titleLabel.intrinsicContentSize.width, self.titleLabel.intrinsicContentSize.height); self.arrowView.center = CGPointMake(CGRectGetMinX(self.titleLabel.frame) - 30, self.titleLabel.center.y); // // CGFloat circleMargin = RefreshAnimMargin + RefreshCircleLineW + 2; // // self.imageView.center = CGPointMake(width / 2.0f, CGRectGetMaxY(self.bounds) - 30); // self.circleView.center = self.imageView.center; // self.circleView.bounds = CGRectMake(0, 0, circleMargin, circleMargin); } - (void)startRefreshing{ self.titleLabel.text = @"释放返回商品详情"; } - (void)finishRefreshing{ self.titleLabel.text = @"下拉返回商品详情"; } // 松开可刷新 - (void)canEngageRefreshWithOffsetY:(CGFloat)y{ self.titleLabel.text = @"释放返回商品详情"; } // 下拉过程 - (void)didDisengageRefreshWithOffsetY:(CGFloat)y{ self.titleLabel.text = @"下拉返回商品详情"; } #pragma mark - property - (UIImageView *)arrowView{ if (_arrowView == nil) { _arrowView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"up_arrow"]]; } return _arrowView; } - (UILabel *)titleLabel{ if (_titleLabel == nil) { _titleLabel = [[UILabel alloc]init]; _titleLabel.font = [UIFont systemFontOfSize:13]; _titleLabel.textColor = UIColorFromRGB(0x666666); _titleLabel.text = @"下拉返回商品详情"; } return _titleLabel; } @end