iOS Shimmer...

作者: Stark_Dylan | 来源:发表于2015-04-10 13:17 被阅读439次

    Shimmer Git hub Page

    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.

    ShimmerShimmer

    Usage

    To use Shimmer, create a FBShimmeringView
    or FBShimmeringLayer
    and add your content. To start shimmering, set theshimmering
    property to 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 openFBShimmering.xcworkpace
    rather than the .xcodeproj
    .)
    Installation
    There are two options:
    Shimmer is available as Shimmer
    in Cocoapods.
    Manually add the files into your Xcode project. Slightly simpler, but updates are also manual.

    Shimmer requires iOS 6 or later.

    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.

    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.

    相关文章

      网友评论

      本文标题:iOS Shimmer...

      本文链接:https://www.haomeiwen.com/subject/martfttx.html