Comments (5)
@wyhazq 你好,我这边测试了一下,并未发现此问题
from xrcarouselview.
刚查了一下,应该是我的问题,我一开始传了3张placeholder的图片进去,用错了,不好意思
from xrcarouselview.
您好,还是这个bug,跟其他东西无关。重现方法:
1.首先后台返回两张图片,显示正确。
2.后台去掉第一张图片
3.客户端reload的时候,我调用self.carouselView.imageArray = images;
4.你那边调用
- (void)downloadImages:(int)index {
NSString *key = _imageArray[index];
//从沙盒中取图片
NSString *path = [[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"XRCarousel"] stringByAppendingPathComponent:[key lastPathComponent]];
NSData *data = [NSData dataWithContentsOfFile:path];
if (data) {
_images[index] = [UIImage imageWithData:data];
return;**//沙盒找到第二张照片,返回。**
}
......
}
5.一开始创建的时候,self.currImageView.frame = CGRectMake(self.width * 2, 0, self.width, self.height);
- (void)setScrollViewContentSize {
if (_images.count > 1) {
self.scrollView.contentSize = CGSizeMake(self.width * 5, 0);
self.scrollView.contentOffset = CGPointMake(self.width * 2, 0);
self.currImageView.frame = CGRectMake(self.width * 2, 0, self.width, self.height);
if (_changeMode == ChangeModeFade) {
_currImageView.frame = CGRectMake(0, 0, self.width, self.height);
_otherImageView.frame = self.currImageView.frame;
_otherImageView.alpha = 0;
[self insertSubview:self.currImageView atIndex:0];
[self insertSubview:self.otherImageView atIndex:1];
}
[self startTimer];
} else {
self.scrollView.contentSize = CGSizeZero;
self.scrollView.contentOffset = CGPointZero;
self.currImageView.frame = CGRectMake(0, 0, self.width, self.height);
}
}
6.刷新页面成功了,但主要是currImageView的x为self.width * 2,导致页面无法显示
//防止在滚动过程中重新给imageArray赋值时报错
if (_currIndex >= _images.count) _currIndex = _images.count - 1;
self.currImageView.image = _images[_currIndex];
self.describeLabel.text = _describeArray[_currIndex];
self.pageControl.numberOfPages = _images.count;
[self layoutSubviews];
麻烦你确认一下,或者是我reload的时候不应该这样赋值,谢谢!
from xrcarouselview.
@wyhazq 你的这种赋值方式没错,我刚刚试了下,我这边没有问题,你重新赋值后,如果数组只有一个元素,就会执行self.currImageView.frame = CGRectMake(0, 0, self.width, self.height);
,不会出现你说的那种情况。你reload的时候打个断点,看看内部是怎么执行的
from xrcarouselview.
结论:我是作者没有支持cocoapods时下载的版本,忘记更新了,老版本一张图片时没有stopTimer,导致的scrollview的contentOffset.x为2*self.width造成的bug。
过程:谢谢作者提醒,我早上断点调了下,frame是正确的,然后找了好久,终于发现原来是一张图片时没有stopTimer,兴高采烈的去下载demo,重现一下,发觉并没有重现,点进去一看,原来已经修复此bug,瞬间发现是自己懵逼了,原来和作者不在一个频道上......
十分抱歉,以后发现什么bug必须的先更新到最新版本,查看issue才行。添加了pod,现在没事了,感谢提醒,XRCarouselView很好用,赞一个!
from xrcarouselview.
Related Issues (20)
- 使用本地gif图时崩溃
- swift3 使用网络图片地址报错 HOT 5
- 下载图片时数组越界闪退
- 离线展示问题 HOT 3
- xrcarouseView加在scrollView或者继承scrollView的控件上,当有描述文字时,pageControl的位置会变化,位于描述文字的上方了 HOT 1
- pageControl 位置计算错乱 HOT 2
- 你用的NSTimer方法iOS10才有的吧,iOS9运行直接崩溃 HOT 1
- 定时器可能存在点问题或者 HOT 1
- 展位图没有展示 HOT 2
- 在UICollectionViewCell或者UITableViewCell中的问题 HOT 2
- iOS8 scrollView crash
- 单张图快速拖动时,会闪现一下上一张图,有点瑕疵
- 使用Xib时,部分属性设置无效 HOT 2
- getCurrentImageView 方法没有了,能否提供一个替代的方法?
- 下载图片时数组越界闪退 HOT 2
- 不支持不轮播?
- 竟然不能监听所在位置的下标?
- scrollView width为浮点小数时,会出现index计算不准,导致页面不能自动轮播 HOT 2
- 你的那个展位图如果用的是你的pod方式 我设置了 一个包含了图片网址数组作为dataarray 代码获取不到你这张pod里面的图片 就会崩溃到这 我把你这张图片拿到 移到assets里面就好了 所以应该是没获取到你pod里面的图片 你看看应该怎么处理吧 现在两个地方都有这张图片 项目也没有报错了 哈哈
- 轮播图全屏的时候,push到下个界面,会出现imageview重新计算大小导致大小不是全屏
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xrcarouselview.