Skip to content

Commit 0c97fa5

Browse files
committed
banner 支持 gif 图片
1 parent 2d3ff1f commit 0c97fa5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Coding_iOS/Views/CodingBannersView.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "CodingBannersView.h"
1010
#import "SMPageControl.h"
1111
#import "AutoSlideScrollView.h"
12+
#import "YLImageView.h"
1213

1314
@interface CodingBannersView ()
1415
@property (assign, nonatomic) CGFloat padding_top, padding_bottom, image_width, ratio;
@@ -96,7 +97,7 @@ - (void)setCurBannerList:(NSArray *)curBannerList{
9697
};
9798
slideView.fetchContentViewAtIndex = ^UIView *(NSInteger pageIndex){
9899
if (weakSelf.curBannerList.count > pageIndex) {
99-
UIImageView *imageView = [weakSelf p_reuseViewForIndex:pageIndex];
100+
YLImageView *imageView = [weakSelf p_reuseViewForIndex:pageIndex];
100101
CodingBanner *curBanner = weakSelf.curBannerList[pageIndex];
101102
[imageView sd_setImageWithURL:[curBanner.image urlWithCodePath]];
102103
return imageView;
@@ -128,18 +129,18 @@ - (void)setCurBannerList:(NSArray *)curBannerList{
128129
NSLog(@"%@", _curBannerList);
129130
}
130131

131-
- (UIImageView *)p_reuseViewForIndex:(NSInteger)pageIndex{
132+
- (YLImageView *)p_reuseViewForIndex:(NSInteger)pageIndex{
132133
if (!_imageViewList) {
133134
_imageViewList = [[NSMutableArray alloc] initWithCapacity:3];
134135
for (int i = 0; i < 3; i++) {
135-
UIImageView *view = [[UIImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, _padding_top, _image_width, _image_width * _ratio)];
136+
YLImageView *view = [[YLImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, _padding_top, _image_width, _image_width * _ratio)];
136137
view.backgroundColor = [UIColor colorWithHexString:@"0xe5e5e5"];
137138
view.clipsToBounds = YES;
138139
view.contentMode = UIViewContentModeScaleAspectFill;
139140
[_imageViewList addObject:view];
140141
}
141142
}
142-
UIImageView *imageView;
143+
YLImageView *imageView;
143144
NSInteger currentPageIndex = self.mySlideView.currentPageIndex;
144145
if (pageIndex == currentPageIndex) {
145146
imageView = _imageViewList[1];

0 commit comments

Comments
 (0)