当前位置:编程学习 > wap >>

为什么 willDisplayFooterView代理方法不被调用

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    //将要显示最后一个cell时候进行刷新
    if (indexPath.row == [[_dataArray objectAtIndex:0] count] - 1)
    {
        UIView * footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)];
        UIImageView * imageview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"loading_line.png"]];
        imageview.frame = CGRectMake(0, 20, 320, 20);
        UIImageView * sharkView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"loading_shark.png"]];
        sharkView.frame = CGRectMake(0, 0, 30, 20);
        [imageview addSubview:sharkView];
        [footerView addSubview:imageview];
        [_tableView setTableFooterView:footerView];
        _tableView.tableFooterView.frame = CGRectMake(_tableView.tableFooterView.frame.origin.x, _tableView.tableFooterView.frame.origin.y, 320, 44);
        NSLog(@"666");

    }
    else
    {
      //  _tableView.tableFooterView = nil;
        NSLog(@"555");
    }
}

- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section
{
    if (section == 0) {
          NSLog(@"12344");
    }
  
}

为什么 willDisplayFooterView代理方法不被调用,  willDisplaycell的方法都被调用了. --------------------编程问答-------------------- --------------------编程问答-------------------- willDisplayFooterView显示的不是你tablecell里面最后一个cell,是footerView,当然不被调用啦 --------------------编程问答--------------------
引用 2 楼 hawkswujh 的回复:
willDisplayFooterView显示的不是你tablecell里面最后一个cell,是footerView,当然不被调用啦


这个我知道啊,但是我的footerview已经显示出来了,其代理方法也没有被调用 --------------------编程问答-------------------- 我遇到了同样的问题,,,willDisplayFooterView还是willDisplayHeaderView这两个方法都不走,就是不明白,不管怎么样,指定了代理,遵守了协议,实现了这个方法,,都应该要走啊,,,可是结果,都不走,,,,,,,,,,你现在有解决的方法了吗?请教 --------------------编程问答-------------------- 一个就是self的delegate看看有么有设置,还有就是你的tableview药加载在一个view视图上,不要addsubview到一个uibutton或者uilabel上面了, --------------------编程问答-------------------- 这里的footer,header应该指的是section的footer以及header,不是整个tableview的footer或header --------------------编程问答-------------------- 楼主,你要调用了这个方法后,- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 40;
}
才可以调用你所说的方法
补充:移动开发 ,  iPhone
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,