Skip to content

Commit 099fc76

Browse files
committed
Banner UI 小改
1 parent 9f0c49a commit 099fc76

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Coding_iOS/Views/CodingBannersView.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ - (instancetype)init
3737
}
3838

3939
- (void)setCurBannerList:(NSArray *)curBannerList{
40-
if ([[_curBannerList valueForKey:@"id"] isEqualToArray:[curBannerList valueForKey:@"id"]]) {
40+
if ([[_curBannerList valueForKey:@"title"] isEqualToArray:[curBannerList valueForKey:@"title"]]) {
4141
return;
4242
}
4343
_curBannerList = curBannerList;
@@ -52,6 +52,7 @@ - (void)setCurBannerList:(NSArray *)curBannerList{
5252
label.text = @"活动";
5353
label;
5454
});
55+
_typeLabel.text = [(CodingBanner *)_curBannerList.firstObject name];
5556
[self addSubview:_typeLabel];
5657
}
5758

@@ -64,8 +65,8 @@ - (void)setCurBannerList:(NSArray *)curBannerList{
6465
label.adjustsFontSizeToFitWidth = YES;
6566
label;
6667
});
67-
[self addSubview:_titleLabel];
6868
_titleLabel.text = [(CodingBanner *)_curBannerList.firstObject title];
69+
[self addSubview:_titleLabel];
6970
}
7071

7172
if (!_myPageControl) {
@@ -87,7 +88,7 @@ - (void)setCurBannerList:(NSArray *)curBannerList{
8788
if (!_mySlideView) {
8889
_mySlideView = ({
8990
__weak typeof(self) weakSelf = self;
90-
AutoSlideScrollView *slideView = [[AutoSlideScrollView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, _padding_top, _image_width, _image_width * _ratio) animationDuration:5.0];
91+
AutoSlideScrollView *slideView = [[AutoSlideScrollView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, _padding_top, _image_width, _image_width * _ratio) animationDuration:10.0];
9192
slideView.layer.cornerRadius = 2.0;
9293
slideView.layer.masksToBounds = YES;
9394
slideView.scrollView.scrollsToTop = NO;
@@ -108,9 +109,10 @@ - (void)setCurBannerList:(NSArray *)curBannerList{
108109
slideView.currentPageIndexChangeBlock = ^(NSInteger currentPageIndex){
109110
if (weakSelf.curBannerList.count > currentPageIndex) {
110111
CodingBanner *curBanner = weakSelf.curBannerList[currentPageIndex];
112+
weakSelf.typeLabel.text = curBanner.name;
111113
weakSelf.titleLabel.text = curBanner.title;
112114
}else{
113-
weakSelf.titleLabel.text = @"...";
115+
weakSelf.typeLabel.text = weakSelf.titleLabel.text = @"...";
114116
}
115117
weakSelf.myPageControl.currentPage = currentPageIndex;
116118
};
@@ -161,6 +163,7 @@ - (void)reloadData{
161163
NSInteger currentPageIndex = MIN(self.mySlideView.currentPageIndex, _curBannerList.count - 1) ;
162164
CodingBanner *curBanner = _curBannerList[currentPageIndex];
163165
_titleLabel.text = curBanner.title;
166+
_typeLabel.text = curBanner.name;
164167

165168
_myPageControl.numberOfPages = _curBannerList.count;
166169
_myPageControl.currentPage = currentPageIndex;

0 commit comments

Comments
 (0)