Latest 1.0.0
Homepage https://github.com/huluo666/UITableView-HJEmptyView
License MIT Copyright 2016
Permission is granted to…
Platforms ios 7.0, requires ARC
Authors

UITableView-HJEmptyView

pod ‘UITableView+HJEmptyView’, ‘~> 1.0.0’

利用Runtime一行代码实现UITableView的空视图EmptyView显示,省去没必要的判断和几行代码即可快速自定义精致简洁的空视图显示。大大的减少了viewContoller中的代码量。可重用,整个项目在需要显示空视图控制器,加上一行代码即可。

只需一行代码

self.tableView.HJ_emptyView=self.emptyView;//emptyView需要显示的空视图

演示图

使用

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self.view addSubview:self.tableView];//添加表格视图

    [self setUpEmptyView];//设置空视图
}

NO.1 使用默认空视图

-(void)setUpEmptyView
{
   self.emptyView=[HJEmptyView defaultEmptyView];
}

或 NO.2 使用自定义空视图

-(void)setUpEmptyView
{
    __unsafe_unretained __typeof(self) weakSelf = self;

    //自定义空视图
    HJEmptyView  *emptyView=[HJEmptyView showTitle:@"oh,shit!!!" details:@"对不起,没有网络n请检查网络网络是否打开" iconImag:@"no-wifi" toView:self.view];

    self.emptyView=emptyView;
    //点击刷新按钮
    emptyView.refreshBtnClickBlock=^(UIButton *button){
        [weakSelf MJBeginRefreshing];
    };

    //轻击Empty视图回调
    emptyView.refreshEmptyTapBlock=^(UIView *view){
        [weakSelf MJBeginRefreshing];
    };

    self.tableView.HJ_emptyView=self.emptyView;
}

Latest podspec

{
    "name": "UITableView+HJEmptyView",
    "version": "1.0.0",
    "summary": "u4e00u884cu4ee3u7801u89e3u51b3u7a7au89c6u56feuff0cu9002u7528u4e8eu65e0u6570u636euff0cu65e0u7f51u7edcu7b49u7a7au89c6u56feu63d0u793auff0cu53efu81eau5b9au4e49u91cdu8f7du7b49u529fu80fd",
    "description": "u5229u7528Runtimeu663eu793au7a7au89c6u56feuff0cu4e00u884cu4ee3u7801u89e3u51b3u7a7au89c6u56feu95eeu9898uff0cu9002u7528u4e8eu65e0u6570u636euff0cu65e0u7f51u7edcu7b49u7a7au89c6u56feu63d0u793auff0cu53efu81eau5b9au4e49u91cdu8f7du7b49u529fu80fd",
    "homepage": "https://github.com/huluo666/UITableView-HJEmptyView",
    "license": {
        "type": "MIT",
        "text": "                   Copyright 2016n                   Permission is granted to...n"
    },
    "authors": {
        "huluo666": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/huluo666/UITableView-HJEmptyView.git",
        "tag": "1.0.0"
    },
    "source_files": [
        "Classes",
        "UITableView+HJEmptyView/HJEmptyView/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "requires_arc": true
}

Pin It on Pinterest

Share This