Commit 2bf28498 authored by lufei's avatar lufei

modify:修复在索引为0位置,往左划,索引错误的bug;优化setdataarr后pagecontrol控件也置0

parent 18b33d2d
...@@ -237,7 +237,7 @@ static BOOL isScrolling = NO; ...@@ -237,7 +237,7 @@ static BOOL isScrolling = NO;
-(void)scroll { -(void)scroll {
if (_dataArr.count > 1) { if (_dataArr.count > 1) {
if (_isLast) { if (_isLast) {
self.currentIndex = (_currentIndex - 1)%_dataArr.count; self.currentIndex = (_currentIndex - 1 + _dataArr.count)%_dataArr.count;
}else{ }else{
self.currentIndex = (_currentIndex + 1)%_dataArr.count; self.currentIndex = (_currentIndex + 1)%_dataArr.count;
} }
...@@ -248,7 +248,7 @@ static BOOL isScrolling = NO; ...@@ -248,7 +248,7 @@ static BOOL isScrolling = NO;
} }
//更新内容 //更新内容
- (void)updateViewData { - (void)updateViewData {
[self addProperty:_dataArr[(_currentIndex-1)%_dataArr.count] toObj:_lastV]; [self addProperty:_dataArr[(_currentIndex-1+_dataArr.count)%_dataArr.count] toObj:_lastV];
[self addProperty:_dataArr[_currentIndex] toObj:_currentV]; [self addProperty:_dataArr[_currentIndex] toObj:_currentV];
[self addProperty:_dataArr[(_currentIndex+1)%_dataArr.count] toObj:_nextV]; [self addProperty:_dataArr[(_currentIndex+1)%_dataArr.count] toObj:_nextV];
...@@ -362,7 +362,7 @@ static BOOL isScrolling = NO; ...@@ -362,7 +362,7 @@ static BOOL isScrolling = NO;
if (_currentIndex < 0 || _currentIndex >= _dataArr.count) return; if (_currentIndex < 0 || _currentIndex >= _dataArr.count) return;
NSInteger willShowIndex; NSInteger willShowIndex;
if (isLast) { if (isLast) {
willShowIndex = (_currentIndex - 1)%_dataArr.count; willShowIndex = (_currentIndex - 1 + _dataArr.count)%_dataArr.count;
}else{ }else{
willShowIndex = (_currentIndex + 1)%_dataArr.count; willShowIndex = (_currentIndex + 1)%_dataArr.count;
} }
...@@ -418,6 +418,9 @@ static BOOL isScrolling = NO; ...@@ -418,6 +418,9 @@ static BOOL isScrolling = NO;
//页面展示block(第一次进来) //页面展示block(第一次进来)
_pageWillShowBlock(0, _dataArr[0]); _pageWillShowBlock(0, _dataArr[0]);
_pageShowBlock(0, _dataArr[0]); _pageShowBlock(0, _dataArr[0]);
if (_carouselConfig.showPageControl) {
_pageControl.currentPage = 0;
}
} }
@end @end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment