分享 iOS 自动循环轮播组件 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
liaojinxing
V2EX    iDev

分享 iOS 自动循环轮播组件

  •  
  •   liaojinxing 2015-10-14 20:04:06 +08:00 3050 次点击
    这是一个创建于 3652 天前的主题,其中的信息可能已经有所发展或是发生改变。

    可实现自动循环轮播 slider 效果

    源码和使用 demo 都在这里: https://github.com/liaojinxing/LJAutoScrollView

    欢迎使用,如有问题也请不吝赐教。

    LJAutoScrollView

    LJAutoScrollView class provides an endlessly circulate scroll view. It allows auto scrolling infinitely in the horizontal direction.

    • It offers an encapsulation of UICollectionView to support reuse features.

    • Use NSTimer for auto scrolling.

    • The implement of infinite scroll is inspired by this page:Circular Infinite UIScrollView

    Comparison

    Compared to other implmentation, LJAutoScrollView is more stable and easier to use:
    - Some implementation like GBInfiniteScrollView is subclass from UIScrollView, while LJAutoScrollView uses UICollectionView, it's more stable on reuse feature and gesture recognization.

    • LJAutoScrollView integrates UIPageControl as well. You need not to handle the page change yourself.

    • The infinite circulate scroll feature implementation is more elegant and robust than SDCycleScrollView.

    • It's easier to use. The usage is described below.

    Installation

    Grab the source file into your project.

    Or use cocoapods. Here is an example of your podfile:

    pod 'LJAutoScrollView' 

    Usage

    • LJAutoScrollView is a subclass of UIView. Just take it as UIView when initialization.
    self.autoScrollView = [[LJAutoScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, kAutoScrollViewHeight)]; self.autoScrollView.delegate = self; 
    • Configure it as you like.
    self.autoScrollView.itemSize = CGSizeMake(self.view.frame.size.width, kAutoScrollViewHeight); self.autoScrollView.scrollInterval = 3.0f; 
    • Don't forget to implement the delegate methods.

    Check the demo project for more details.

    2 条回复    2015-10-19 20:36:39 +08:00
    Ixizi
        1
    Ixizi  
       2015-10-18 16:19:22 +08:00
    看不懂,你就不能上个 GIF 图片吗
    strom001
        2
    strom001  
       2015-0-19 20:36:39 +08:00
    点开就有了啊
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1358 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 26ms UTC 17:07 PVG 01:07 LAX 10:07 JFK 13:07
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86