89 lines
3.2 KiB
Objective-C
89 lines
3.2 KiB
Objective-C
//
|
|
// PagingViewTableHeaderView.m
|
|
// JXCategoryView
|
|
//
|
|
// Created by jiaxin on 2018/8/27.
|
|
// Copyright © 2018年 jiaxin. All rights reserved.
|
|
//
|
|
|
|
#import "PagingViewTableHeaderView.h"
|
|
|
|
@interface PagingViewTableHeaderView()
|
|
@property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图
|
|
@property (nonatomic, strong) UIImageView *vipImageView;
|
|
@property (nonatomic, strong) UIImageView *wanImageView;
|
|
@end
|
|
|
|
@implementation PagingViewTableHeaderView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_vipbg_icon"]];
|
|
self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
self.bgImageView.clipsToBounds = true;
|
|
[self addSubview:self.bgImageView];
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.top.right.equalTo(self);
|
|
make.height.mas_equalTo(224);
|
|
}];
|
|
[self.bgImageView addSubview:self.vipImageView];
|
|
[self.vipImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.left.equalTo(self.bgImageView).inset(KBFit(27));
|
|
make.top.equalTo(self.bgImageView).offset(KB_NAV_TOTAL_HEIGHT + 25);
|
|
make.height.mas_equalTo((269));
|
|
}];
|
|
[self.bgImageView addSubview:self.wanImageView];
|
|
[self.wanImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.left.equalTo(self.bgImageView);
|
|
make.top.equalTo(self.bgImageView.mas_bottom).offset(-48);
|
|
make.height.mas_equalTo(391);
|
|
}];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)layoutSubviews {
|
|
[super layoutSubviews];
|
|
|
|
}
|
|
|
|
- (void)scrollViewDidScroll:(CGFloat)contentOffsetY {
|
|
|
|
}
|
|
|
|
//- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
|
|
// CGFloat targetWidth = layoutAttributes.size.width > 0 ? layoutAttributes.size.width : KB_SCREEN_WIDTH;
|
|
// // 先把自身宽度设为目标宽,便于系统计算高度
|
|
// self.bounds = CGRectMake(0, 0, targetWidth, self.bounds.size.height);
|
|
// [self setNeedsLayout];
|
|
// [self layoutIfNeeded];
|
|
// CGSize fit = [self systemLayoutSizeFittingSize:CGSizeMake(targetWidth, UILayoutFittingCompressedSize.height)
|
|
// withHorizontalFittingPriority:UILayoutPriorityRequired
|
|
// verticalFittingPriority:UILayoutPriorityFittingSizeLevel];
|
|
// CGRect f = layoutAttributes.frame;
|
|
// f.size.height = ceil(fit.height);
|
|
// layoutAttributes.frame = f;
|
|
// return layoutAttributes;
|
|
//}
|
|
|
|
|
|
- (UIImageView *)vipImageView {
|
|
if (!_vipImageView) {
|
|
_vipImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_vip_icon"]];
|
|
_vipImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
}
|
|
return _vipImageView;
|
|
}
|
|
|
|
- (UIImageView *)wanImageView {
|
|
if (!_wanImageView) {
|
|
_wanImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pay_wanwhite_icon"]];
|
|
_wanImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
}
|
|
return _wanImageView;
|
|
}
|
|
|
|
@end
|