iOS开发---当tableview滚到视图底部展开列表后看不到数据

来源:互联网 发布:手机 usb 共享网络 编辑:程序博客网 时间:2024/06/07 10:41


实现类型qq列表的效果

   在自定义section表头的点击事件中操作
    CGPoint point = [gesture locationInView:self.view]; //返回触摸点在视图中的当前坐标    CGRect rect=CGRectMake(80, kScreenHeight-64-80, kScreenWidth-90, 60);    // RMLog(@"rect=%f,%f",rect.origin.x,rect.origin.y);    BOOL contains = CGRectContainsPoint(rect, point);    //RMLog(@"contains=%d",contains?1:0);    //将点击了哪一组转换成字符串    NSString *str = [NSString stringWithFormat:@"%ld",gesture.view.tag];    //从字典里面以第几组为key取出状态值    //如果状态值为0,代表关闭    if([self.sectionStatusDict[str] integerValue] == 0){        [self.sectionStatusDict setObject:@(1) forKey:str];        if (contains==YES) {            self.tableView.contentOffset=CGPointMake(self.tableView.contentOffset.x, self.tableView.contentOffset.y+60);        }    }    //如果状态值为不为0,代表展开    else{        [self.sectionStatusDict setObject:@(0) forKey:str];    }    //记得一定要刷新tabelView,不然没有效果    [self.tableView reloadData];


0 0
原创粉丝点击