zoukankan      html  css  js  c++  java
  • [翻译] Shimmer

    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 应用中是使用的效果.

    Shimmer

    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.

  • 相关阅读:
    Oracle 左连接、右连接、全外连接、(+)号作用
    ORA-01940:无法删除当前已链接的用户(转)
    博客正式开通
    python扫描内网存活主机(scapy与nmap模块)
    Python学习之扫描网段主机与开启端口(避坑)
    Python学习之服务器与客户端的交互
    python渗透测试编程之kali linux2的AptanaStudio3安装
    Shellcodeloader免杀过火绒
    Cracer之Waf绕过
    30 Day Challenge Day 16 | Leetcode 692. Top K Frequent Words
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/4418431.html
Copyright © 2011-2022 走看看