Shimmer

Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator.

Shimmer was originally developed to show loading status in Paper.

使用Shimmer可以让你非常容易的添加闪光效果到你的app当中,尤其是在加载的时候使用,非常有用.

Shimmer最初是在 Paper 应用中是使用的效果.

Usage

To use Shimmer, create a FBShimmeringView or FBShimmeringLayer and add your content. To start shimmering, set the shimmering property to YES.

如果你要使用Shimmer,创建出FBShimmeringView或者是FBShimmeringLayer,然后添加上你的content.为了显示闪光效果,将shimmering属性设置成YES.

An example of making a label shimmer:

FBShimmeringView *shimmeringView = [[FBShimmeringView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:shimmeringView]; UILabel *loadingLabel = [[UILabel alloc] initWithFrame:shimmeringView.bounds];
loadingLabel.textAlignment = NSTextAlignmentCenter;
loadingLabel.text = NSLocalizedString(@"Shimmer", nil);
shimmeringView.contentView = loadingLabel; // Start shimmering.
shimmeringView.shimmering = YES;

There's also an example project. In the example, you can swipe horizontally and vertically to try various shimmering parameters, or tap to start or stop shimmering. (To build the example locally, you'll need to open FBShimmering.xcworkpace rather than the .xcodeproj.)

Installation

There are two options:

有两种安装方式:

  1. Shimmer is available as Shimmer in Cocoapods. 使用Cocoapods安装
  2. Manually add the files into your Xcode project. Slightly simpler, but updates are also manual. 直接将项目源码拖到你的项目当中.

Shimmer requires iOS 6 or later.

Shimmer 需要iOS6或者以上版本.

How it works

Shimmer uses the -[CALayer mask] property to enable shimmering, similar to what's described in John Harper's 2009 WWDC talk (unfortunately no longer online). Shimmer uses CoreAnimation's timing features to smoothly transition "on-beat" when starting and stopping the shimmer.

Shimmer使用了-[CALayer mask]属性来制造闪光效果.

Other Platforms

We have a version of Shimmer for Android, too! It's also available on GitHub.

Contributing

See the CONTRIBUTING file for how to help out.

License

Shimmer is BSD-licensed. We also provide an additional patent grant.

最新文章

  1. 闲的写写SQL
  2. Linux操作系统启动流程浅析
  3. getHeight returns 0 for all Android UI objects
  4. 【BZOJ】1046 : [HAOI2007]上升序列
  5. Apache CXF框架结构和基本原理(转)
  6. iOS - 应用程序国际化
  7. linux 内核驱动加载过程中 向文件系统中的文件进行读写操作
  8. android 7.0带来的
  9. SQL复习一(基础知识)
  10. iOS日历控件
  11. xx.hbm.xml中相关重要的配置
  12. Scala 中方法扩展实践
  13. 【读书笔记】iOS-应用内购买
  14. flask模板结构组织(局部模板、宏、模板继承)
  15. 解决idea控制台乱码及项目乱码
  16. 鼠标滚轮更改transform的值(vue-scroller在PC端的上下滑动)
  17. Windows Defender还原误删文件
  18. VMware Fusion 5 正式版序列号
  19. 去掉python的警告
  20. 团队作业8——测试与发布(Beta阶段)之展示博客

热门文章

  1. Hadoop Hive概念学习系列之hive三种方式区别和搭建、HiveServer2环境搭建、HWI环境搭建和beeline环境搭建(五)
  2. Linux 进程以及多线程的支持
  3. Manjaro解决 Node.JS Error: ENOSPC
  4. Flume初始
  5. 陈新宇:CKafka在人脸识别PAAS中的应用
  6. 在ViewDidLoad中往导航栈推ViewController报错
  7. [转]asp.net权限认证:摘要认证(digest authentication)
  8. sql递归显示层级数据
  9. 初识JSP,第一天
  10. JS实现最短路径之弗洛伊德(Floyd)算法