123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- //
- // 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
|