Giter Club home page Giter Club logo

nodataloadingview's Introduction

NodataLoadingView

NodataLoadingView 在webView\scrollView\TableView刷新数据没有完全显示的时候,显示的一个占位view。

演示

  • RefreshButton -- 点击可以执行初始化时设置的block simulator screen shot 2015 9 22 7 12 39
  • Refreshing -- 正在刷新过程中 simulator screen shot 2015 9 22 7 21 51 *其他
    • Label --不可点击,显示下状态
    • Hidden -- 刷新出来数据后隐藏
    • Show --显示

用法实例

初始化

1、你需要在添加之前,首先将要设置NoDataLoadingView的View添加到父视图上

    [self.view addSubview:WebView];
    [WebView addNodataLoadingViewWithLogoImage:[UIImage imageNamed:@"background"] refreshBlock:^{
        [WebView loadRequest:[NSURLRequest requestWithURL:url]];
    }];

2、设置状态

        [WebView setNodataLoadingViewState:NoDataLodingViewStateRefreshButton title:@"点击刷新"];

可以设置的状态有:

typedef NS_ENUM(NSInteger, NoDataLodingViewState){
    NoDataLodingViewStateNodataLabel,               //Label形式,不能点击
    NoDataLodingViewStateRefreshButton,             //Button 点击执行相应的block
    NoDataLodingViewStateHidden,                    //隐藏
    NoDataLodingViewStateShow,                      //显示
    NoDataLodingViewStateRefreshing                 //刷新
};

统一使用的的设置方法为:

- (void)setNodataLoadingViewState:(NoDataLodingViewState)state title:(NSString *)title;

3、可以重新设置要执行的block,设置方法为:

- (void)setNewRefreshBlock:(void (^)())newsRefreshBlock;

4、可以设置刷新时的UIActivityIndicatorViewStyle

- (void)setNodataLoadingViewActivityStyle:(UIActivityIndicatorViewStyle)style;

5、在不需要的时候可以移除掉

- (void)removeNodataLoadingView;

最后

如果使用中遇到问题或bug,请留言。期望共同学习,共同进步!

nodataloadingview's People

Contributors

kklater avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.