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 · Oct 14, 2015 · 3751 views
    This topic created in 4003 days ago, the information mentioned may be changed or developed.

    可实现自动循环轮播 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 replies  •  2015-10-19 20:36:39 +08:00
    Ixizi
        1
    Ixizi  
       Oct 18, 2015
    看不懂,你就不能上个 GIF 图片吗
    strom001
        2
    strom001  
       Oct 19, 2015
    点开就有了啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   955 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 19:14 · PVG 03:14 · LAX 12:14 · JFK 15:14
    ♥ Do have faith in what you're doing.