监听uitableview 数据加载完成重新设置tableview的高度

来源:互联网 发布:买玩具枪被判无期知乎 编辑:程序博客网 时间:2024/05/26 19:15

通过tableview 的代理方法实现

//tableview 加载完成可以调用的方法--因为tableviewcell高度不定,所以在加载完成以后重新计算高度

-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

    if([indexPathrow] == ((NSIndexPath*)[[tableViewindexPathsForVisibleRows]lastObject]).row){

        //end of loading

        dispatch_async(dispatch_get_main_queue(), ^{

            

            self.detailListView.frame = CGRectMake(self.detailListView.frame.origin.x,self.detailListView.frame.origin.y,MAIN_WIDTH, tableView.contentSize.height);


        });

    }

}


0 0
原创粉丝点击