美文网首页
给tableview加没有网络和没有数据的页面

给tableview加没有网络和没有数据的页面

作者: iaiayao | 来源:发表于2018-02-23 15:01 被阅读4次

// 刷新列表信息

//static CGFloat const HeightHeadrView = 70.0;

+ (void)refreshTableView:(NSArray *)dataSource tabelview:(UITableView *)tableview message:(NSString *)message image:(NSString *)image {     

    if (!dataSource || 0 == dataSource.count)     {         

        UIView *footView = InsertView(nil, CGRectMake(0, 0, tableview.width, kBodyHeight - AutoWHGetHeight(150.0)), nil);         

        UIImageView *nilShopImage = InsertImageView(footView, CGRectMake((tableview.width - AutoWHGetWidth(150.0)) / 2.0, AutoWHGetHeight(126.0), AutoWHGetWidth(150.0), AutoWHGetHeight(150.0)), [UIImage imageNamed:image]);

        InsertLabel(footView, CGRectMake(0, nilShopImage.bottom + AutoWHGetHeight(20.0), tableview.width, AutoWHGetHeight(19.0)), NSTextAlignmentCenter, message, kFontSize16, kColorBlack, NO);         

    tableview.tableFooterView = footView;    

     }     else     {

           tableview.tableFooterView = nil;       

          [DataHelper setExtraCellLineHidden:tableview];     

    }        

      [tableview reloadData];

}

+ (void)setExtraCellLineHidden:(UITableView *)tableView {    

     UIView *view =[[UIView alloc] init];    

     view.backgroundColor = [UIColor clearColor];    

     [tableView setTableFooterView:view];

}

相关文章

网友评论

      本文标题:给tableview加没有网络和没有数据的页面

      本文链接:https://www.haomeiwen.com/subject/gcjxxftx.html