美文网首页
iOS如何给没有数据的cell隐藏分割线

iOS如何给没有数据的cell隐藏分割线

作者: mnz12138 | 来源:发表于2018-01-31 15:03 被阅读0次

    应用场景:例如搜索时候只有一条数据,其他空白cell分割线隐藏起来

    UIView *view = [[UIView alloc] init];
    [view setBackgroundColor:[UIColor clearColor]];
    self.tableView.tableFooterView = view;
    

    为了方便其他地方用,可以给tableView写分类

    @interface UITableView (Additions)
    - (void)dx_hideTableEmptyDataSeparatorLine;
    @end
    
    - (void)dx_hideTableEmptyDataSeparatorLine {
        UIView *view = [[UIView alloc] init];
        [view setBackgroundColor:[UIColor clearColor]];
        self.tableFooterView = view;
    }
    

    相关文章

      网友评论

          本文标题:iOS如何给没有数据的cell隐藏分割线

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