Latest 1.0.6
Homepage https://github.com/bufferapp/BFRGIFRefreshControl
License MIT
Platforms ios 9.0, requires ARC
Dependencies FLAnimatedImage, Masonry
Frameworks UIKit
Authors , ,

Demo

[CocoaPods]() [CocoaPods]() [CocoaPods]()

Summary

The BFRGifRefreshControl is an extremely lightweight, unintrusive and configurable way to add a .gif to refreshing actions inside of your iOS app 📱! You have total control over it, and the whole package comes in at just over 100 lines 😃!

Installation

The BFRGifRefreshControl is hosted on CocoaPods and is the recommended way to install it:

pod 'BFRGifRefreshControl'

Quickstart

To get going, you can either initialize the .gif from your app bundle or via NSData which can be retrived from a network call or other means.
The flow is consists of adding it your table view, setting your desired offset values for your situation and then calling [refreshControl containingScrollViewDidEndDragging] from your tableview instance’s scrollViewDidEndDragging:willDecelerate:.

Here is a quick example:

self.gifRefresh = [[BFRGifRefreshControl alloc] initWithGifFileName:@"myGif" refreshAction:^ {
    //Calls [self.gifRefresh stopAnimating] inside of performFakeDataRefresh
    [self performFakeDataRefresh];
}];

self.gifRefresh.dataRefreshOffsetThreshold = 100.0f; //Trigger refresh after user has scrolled this far
self.gifRefresh.dataRefreshingGifYInset = 115.0f; //Where we want the gif to "hang out" while it performs the block
self.gifRefresh.dataLoadedYInset = 64.0f; //Account for navbar
self.gifRefresh.dataLoadedYOffset = -64.0f; //Account for navbar

If you want some additional context, just fire up the demo project and take a peek 👌! This is the easiest way to see how to fire it up!

Wait – that seems like a good bit of configuration! Why?

  • Is the view controller’s automaticallyAdjustsScrollViewInsets set to YES or NO?
  • Is there a nav bar?
  • Is the view hierarchy complex and customized?
  • Perhaps you need an offset larger or smaller for other UI elements?
  • …etc

Those are all valid questions! The BFRGifRefreshControl was designed to be usable no matter the situation you find youself in. We could make assumptions or controll the UIScrollView via a category, but
every developer faces different situations and those assumptions could sometimes be wrong or lead to some tricky debugging 🐛.

It’s true that most scenarios call for direct opposite values for the Y inset and offset (i.e. 64 and -64) and that the threshold to trigger a refresh just needs to be the same as the control’s height – but that’s not 100% always the case. For that reason we’ve opted for those values to be consciously set by the developer 👍

Important Note

  • The constraints are geared for more smaller, "logo" style .gif files (around 50 x 50). Things could certainly be changed to accomodate all sizes fairly easily, but it would require a few tweaks 😎.

Going Forward

We regularly maintain this code, and you can also rest assured that it’s been battle tested against thousands of users in production 👍. That said, we get things wrong from time to time – so feel free to open an issue for anything you spot!

We are always happy to talk shop, so feel free to give us a shout on Twitter:

Or, hey – why not work on the BFRGifRefreshControl and get paid for it!? We’re hiring!


Licence

This project uses MIT License.

Latest podspec

{
    "name": "BFRGifRefreshControl",
    "version": "1.0.6",
    "summary": "A simple and lightweigh refresh control.",
    "description": "The BFRGifRefreshControl is an extremely lightweight, unintrusive and configurable way to add a .gif to refreshing actions inside of your iOS app ud83dudcf1! You have total control over it, and the whole package comes in at just over 100 lines ud83dude03!",
    "homepage": "https://github.com/bufferapp/BFRGIFRefreshControl",
    "screenshots": "https://camo.githubusercontent.com/462bed11b83ed04bca6f02a0fb54f4e59c651f74/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f662e636c2e6c792f6974656d732f3248303533583236326f3335315a3132324f334d2f53637265656e2532305265636f7264696e67253230323031362d30342d3238253230617425323031322e3535253230504d2e6769663f763d3263633434653339",
    "license": "MIT",
    "authors": {
        "Andrew Yates": "[email protected]",
        "Jordan Morgan": "[email protected]",
        "Humber Aquino": "[email protected]"
    },
    "social_media_url": "https://twitter.com/bufferdevs",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/bufferapp/BFRGIFRefreshControl.git",
        "tag": "1.0.6"
    },
    "source_files": "GifRefresh/**/BFRGifRefreshControl.{h,m}",
    "frameworks": "UIKit",
    "requires_arc": true,
    "dependencies": {
        "FLAnimatedImage": [],
        "Masonry": []
    }
}

Pin It on Pinterest

Share This