12207480 / tycyclepagerview Goto Github PK
View Code? Open in Web Editor NEWa simple and usefull cycle pager view ,and auto scroll banner view(轮播图) ,include pageControl for iOS,support Objective-C and swift
License: MIT License
a simple and usefull cycle pager view ,and auto scroll banner view(轮播图) ,include pageControl for iOS,support Objective-C and swift
License: MIT License
This is likely occurring because the flow layout subclass SXLineLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them
需要修改为
在 layoutIndicatorViews
{
case UIControlContentHorizontalAlignmentCenter:
orignX = (CGRectGetWidth(self.frame) - (_indicatorViews.count - 1) * (_pageIndicatorSize.width + _pageIndicatorSpaing) - _currentPageIndicatorSize.width )/2;
for ()
{
indicatorView.frame = CGRectMake(orignX , centerY - size.height/2, size.width, size.height);
orignX += size.width + pageIndicatorSpaing;
}
}
如题,我想去掉两端的弹簧效果,然而没找到能控制的接口
有两句警告
The behavior of the UICollectionViewFlowLayout is not defined because:
the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
请尽快支持pod安装
rt
when i run on iOS 11 fps is low and then i use analyze to check maybe have memory leak
i try to solove but i can't so write this issues
thanks
不提供设置圆点常规颜色和选中颜色的接口吗?
只要图片大于四张,就会从第四张图片开始,不会从第一张开始
当打开autoScroll时,在尝试连续性点击item,轮播过程会被打断,这是正常的吗?
我这里的需求是根据cell 的高度来计算item 的高度,但是第一如何获取到pageView ?后来我尝试获取到当前的控制器,然后拿到当前的pageView ,如下代码:
_pagerView.layout.itemSize = CGSizeMake(CGRectGetWidth(_pagerView.frame)*sender.value, CGRectGetHeight(_pagerView.frame)*sender.value);
[_pagerView setNeedUpdateLayout];
但是我发现跑起来,没有改变,并且一滑动,这个布局都乱了。。。求助大,大神!!!
可以加qq 吗?我的qq 是704379869
rt
collectionViewcell 中的数据 从网络获取时 pageView 显示有bug
}
这样设置会有BUG,
因为你这个layout ,我发现这个代理方法只调用一次,这个请问怎么改???
rt
当前在bridge文件中 通过@import TYCyclePagerView; 方式导入可以使用。
https://juejin.im/post/5a52d7cdf265da3e4c07a004。有遇到相同的情况小伙伴可以看看。
如果设置了圆角 此时banner只有一个数据 两边的图片还显示同一图片
而且手动还能滚动 滚动以后还不能居中
在设置pageControl.currentPageIndicatorSize的大小和pageIndicatorSize宽度大小不一致的时候,能否保持他们之间的间距不变
获取数据之后调用[pagerView reloadData]方法,页面显示正常,但手动滚动的话,会自动滚回来,
ios 11以下正常运行
RT
在 - caculateIndexSectionWithOffsetX 方法中,计算 itemIndex 的算法里
代码是这样的 NSInteger itemIndex = (middleOffset - leftEdge + layout.minimumInteritemSpacing / 2) / itemWidth;
其中的 + layout.minimumInteritemSpacing / 2 是否应该改成 - layout.itemSize.width / 2 ?
期待你的回复
初始化时 scrollToItemAtIndexSection:animate: 调用了三次 有效的是第二次 第三次又将偏移量设置为0了。需要延迟设置scrollToItemAtIndex:animate方法才能有效果
用demo运行,ViewController里用延时加载的loadData方法,无法拖动cell。如果将numberOfItemsInPagerView返回值改为固定值则可拖动。
If you do not set autoScrollInterval it will slip very slow
为什么iphone5s尺寸上的图片无法展示完全,而滑动的时候可以?
-(void)loadData {
NSMutableArray *datas = [NSMutableArray array];
for (int i = 0; i < 7; ++i) {
if (i == 0) {
[datas addObject:[UIColor redColor]];
continue;
}
[datas addObject:[UIColor colorWithRed:arc4random()%255/255.0 green:arc4random()%255/255.0 blue:arc4random()%255/255.0 alpha:arc4random()%255/255.0]];
}
_datas = [datas copy];
_pageControl.numberOfPages = _datas.count;
[_pagerView reloadData];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[_pagerView scrollToItemAtIndex:3 animate:YES];
});
}
当我初始化数据完成,想要滚动到指定的index,这时候调用scrollToItemAtIndex 失效,因为layoutSubviews 时候重置了contentOffset,目前是加了个延迟,但是路子有点野,请问有更好的方式没有?
我的轮播cell里面由3个UIImageView和1个AVPlayer, AVPlayer的播放layer在UIImageView上面.
现在遇到的问题是重复轮播几遍之后3个UIImageView上面都播放了视频,
http://ww1.sinaimg.cn/large/0061KoHBgy1fpofm8uwfrj30q217g4nm.jpg
感谢.
## pagerView delegate
- (UICollectionViewCell *)pagerView:(TYCyclePagerView *)pagerView cellForItemAtIndex:(NSInteger)index {
JTZbannerCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"JTZbannerCell" forIndex:index];
NSString *type = self.bannerDataSource[index];
cell.type = type;
return cell;
}
## setType
- (void)setType:(NSString *)type {
_type = type;
if ([type containsString:@"mp4"]) {
[self playerLayer];
[self.player play];
} else {
[self.imageView setImageWithURLString:type placeholderImageName:@"home_p_bg"];
}
}
这出我隐藏掉了。 也能满足要求
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
if ([collectionView respondsToSelector:@selector(setPrefetchingEnabled:)]) {
collectionView.prefetchingEnabled = NO;
}
#endif
我在UIViewcontroller实现UIScrollViewDelegate的scrollViewDidScroll方法,使用了TYCyclePagerView之后,一运行就崩溃,报错原因是reason: '-[AHHomeViewController pagerViewDidScroll:]: unrecognized selector sent to instance 0x7ff0d5631cf0'。
我看了一下源码,在TYCyclePagerView.m文件的setDelegate:方法里面,
_delegateFlags.pagerViewDidScroll = [delegate respondsToSelector:@selector(scrollViewDidScroll:)]
此处是检查delegate是否实现了scrollViewDidScroll:方法,然后在TYCyclePagerView.m 文件里面实现的scrollViewDidScroll方法里面判断_delegateFlags.pagerViewDidScroll是否为真,然后调用的[_delegate pagerViewDidScroll:self]。
如果UIViewcontroller并没有实现pagerViewDidScroll,而只是实现scrollViewDidScroll:方法,就会导致崩溃现象。所以需要修改为
_delegateFlags.pagerViewDidScroll = [delegate respondsToSelector:@selector(pagerViewDidScroll:)]
有设置圆角的接口吗,让其类似卡片播放的效果?
单张图片并且hidesForSinglePage属性设为Yes仍然无法隐藏indicator
希望解答下
你好,
我把轮播设置为NO,cell加载网络图片,发现第一页会出现第五页的网络数据。显示出现问题
但是我无法知道这里是第几个cell 啊,- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView 这个是写在控制器里面的,可以知道这是第几个cell吗,因为每一个cell 的高度都不一样
使用TYCyclePagerView后,实现TableView的代理方法- (void)scrollViewDidScroll:(UIScrollView *)scrollView 会Crash,请问如何解决呢?
qq 704379868
用到此框架做轮播的页面如果 实现 - (void)scrollViewDidScroll:(UIScrollView *)scrollView 这个代理方法就会崩溃呢?
infiniteloop autoscroll itemhor…center 为no 滑到最后一个 reload一下 会居中显示
非常好的轮播 ,别的轮播都是设计好了几个样式,供选择,局限性大。而你的是把cell 交给了程序员自己去设计,可扩展性很强。需求需要,希望支持纵向。
解决办法 将tycyclepageview 中的 setcontentoffset:offset animation :animation 改成
[UIView animateWithDuration:0.2 animations:^{
_collectionView.contentOffset = CGPointMake(offset, _collectionView.contentOffset.y);
}];
你好,如果我在某个页面用到了轮播,但是这个页面需要在- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
}
这个方法里做某些事情,只要用到你的框架实现轮播的页面实现- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
}这个代理方法就会崩溃呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.