Latest 1.0.0
Homepage https://github.com/needbee/uiview-loading
License MIT
Platforms ios 6.0, requires ARC
Authors

uiview-loading

Category to show a loading indicator inside any kind of UIView.

Demo

The demo/ folder contains a demo project showing UIView+Loading in use. Open and run it.

Usage

Import "UIView+Loading". Then, on your UIView that will be loading asynchronous data, instead of loading it directly, load it inside a block:

[_container loadDataFromLoader:^() {
    // kick off async load here
}];

The block will be run immediately, and the view will display a loading indicator and a translucent white mask will be applied.

When the data load attempt is done, you call a different method depending on whether the load succeeded or failed:

  • If it succeeded, call [_container hideLoadingPrompt]. This will hide the loading indicator and mask.
  • If it failed, call [_container displayReloadPrompt]. This will allow the user to tap to reattempt the data load. (This is why you passed the loader a block containing the loading code.)

Compatibility

This class has been tested back to iOS 6.0.

Implementation

This class is implemented by storing the block of loading code to execute, so it can be rerun upon reload without manual UI work on your part.

License

This code is released under the MIT License. See the LICENSE file for details.

Latest podspec

{
    "name": "UIView+Loading",
    "version": "1.0.0",
    "summary": "Category to show a loading indicator inside any kind of UIView.",
    "homepage": "https://github.com/needbee/uiview-loading",
    "license": "MIT",
    "authors": {
        "Josh Justice": "[email protected]"
    },
    "source": {
        "git": "https://github.com/needbee/uiview-loading.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": [
        "src",
        "src/**/*.{h,m}"
    ]
}

Pin It on Pinterest

Share This