You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
4 years ago
|
//
|
||
|
// TFDiscoverHeaderViewCell.m
|
||
|
// WXReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/2.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFDiscoverHeaderViewCell.h"
|
||
|
|
||
|
@interface TFDiscoverHeaderViewCell ()
|
||
|
{
|
||
|
UIImageView *bannerImageView;
|
||
|
}
|
||
|
@end
|
||
|
|
||
|
@implementation TFDiscoverHeaderViewCell
|
||
|
|
||
|
- (instancetype)initWithFrame:(CGRect)frame
|
||
|
{
|
||
|
if (self = [super initWithFrame:frame]) {
|
||
|
self.backgroundColor = kWhiteColor;
|
||
|
[self createSubViews];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)createSubViews
|
||
|
{
|
||
|
bannerImageView = [[UIImageView alloc] initWithCornerRadiusAdvance:8 rectCornerType:UIRectCornerAllCorners];
|
||
|
bannerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||
|
[self addSubview:bannerImageView];
|
||
|
|
||
|
[bannerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.mas_equalTo(self.mas_left).with.offset(kHalfMargin);
|
||
|
make.top.mas_equalTo(self.mas_top);
|
||
|
make.width.mas_equalTo(self.mas_width).with.offset(- kMargin);
|
||
|
make.height.mas_equalTo(self.mas_height);
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (void)setImageURL:(NSString *)imageURL
|
||
|
{
|
||
|
_imageURL = imageURL;
|
||
|
|
||
|
[bannerImageView setImageWithURL:[NSURL URLWithString:imageURL] placeholder:HoldImage options:YYWebImageOptionSetImageWithFadeAnimation completion:nil];
|
||
|
}
|
||
|
@end
|