Coder Social home page Coder Social logo

ffloopview's Introduction

FFLoopView

功能特点

  • 无限循环的图片轮播器
  • 支持显示提示标签
  • 三种自定义分页控件
  • 指定分页控件位置

屏幕截图

开发环境

  • iOS 8.0+
  • Xcode 7.0+
  • Swift 2.0

安装

  • 进入终端并且切换到 xcodeproj 所在目录
  • 输入以下命令,创建 Podfile
$ pod init
  • 编辑 Podfile,并且输入以下内容
platform :ios, '8.0'
use_frameworks!

pod 'FFLoopView'

使用

Swift

loopView.showImages(urls, tips: tips) { [weak self] index in
    print("选中了第 \(index) 张图像 \(self?.view)")
}

参数说明

  1. urls: 轮播器图像的 URL 数组
  2. tips: 每张图片对应的提示信息字符串数组,可以为 nil
  3. 完成回调:index 选中图像的索引值

注意事项

  1. 完成闭包中的 self 需要使用 [weak self] 否则会出现循环引用
  2. 如果需要释放轮播器视图,需要先调用 loopView.stopTimer() 关闭时钟,否则会出现内存泄漏
  3. 如果由于设备旋转需要重新更新轮播器布局,可以调用 loopView.relayoutView()

Objective-C

__weak typeof(self) weakSelf = self;
[self.loopView showImages:urls tips:nil timeInterval:5.0 selectedImage:^(NSInteger index) {
    NSLog(@"选中了第 %zd 张图片 %@", index, weakSelf.view);
}];

详细信息请参见示例代码

ffloopview's People

Contributors

liufan321 avatar

Watchers

James Cloos avatar ashine avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.