Latest 0.0.3
Homepage https://github.com/litt1e-p/LPEmptyDataSetter
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, UIKit
Authors

create placeholder view for empty data UIViewController/UITableViewController/UICollectionViewController, etc. which needs one line code only!

Features

LPEmptyDataSetter is quite different from other empty dataset third-party lib cause it’s base on KVO & runtime, so when use it just set the key for observe. It’s very convenient & simple.

Installation

  • use cocoapods
    pod 'LPEmptyDataSetter', '~> 0.0.3'
  • manual import
    just download lib folder and add into your project

Usage

  • 1.Firstly custom your placeholder view (any view or subClass of UIView)

    // for example, custom placeholder view via UIButton
    UIButton *placeholder = [[UIButton alloc] init];
    placeholder.frame = CGRectMake(150, 200, 80, 80);
  • 2.Add LPEmptyDataSetter to your viewController & view
    
    /**
  • target:view controller which placeholder will show inside
  • key: observe key name that KVO supports
  • view: placeholder view
  • frame: placeholder’s frame
    */
    [LPEmptyDataSetter emptyDataSetWithTarget:self key:@"data" view:placeholder frame:placeholder.frame];

  • 3.Additional
    placeholder view is under your view controller's control, you can add some event for it so that you can change the placeholder view dynamically, such as sample project show. enjoy it now!

    One more thing

LPEmptyDataSetter is base on KVO, when your observing key value has changed, please set a new variables for your key:

// if your observing key is "data"
NSMutableArray *temp = [NSMutableArray arrayWithArray:"array you fetched"];
//trigger KVO method 1
self.data = temp;
//trigger KVO method 2
[[self mutableArrayValueForKey:@"data"] addObjectsFromArray:"array you fetched"];

it’s similar with other data structure such as NSMutableDictionary/NSDictionary or etc.

Screenshot

Release notes

ver. 0.0.3

fix bug of emptyDataSet view back when current view s height narrow

ver. 0.0.2

fix a bug causing crash

ver. 0.0.1

first commit

Latest podspec

{
    "name": "LPEmptyDataSetter",
    "version": "0.0.3",
    "summary": "create empty dataSet view for empty data UIViewController/UITableViewController/UICollectionViewController, etc.",
    "description": "create empty dataSet view for empty data UIViewController/UITableViewController/UICollectionViewController, etc. which needs one line code only!",
    "homepage": "https://github.com/litt1e-p/LPEmptyDataSetter",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "litt1e-p": "[email protected]"
    },
    "source": {
        "git": "https://github.com/litt1e-p/LPEmptyDataSetter.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "LPEmptyDataSetter/*",
    "frameworks": [
        "Foundation",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This