首页 > 其他 > 详细

TableViewCell自定义折叠

时间:2015-12-10 19:01:13      阅读:150      评论:0      收藏:0      [点我收藏+]

---恢复内容开始---

 

主要是通过两个代理方法:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if ([[self.selectArray objectForKey:indexPath]  isEqual: @"100"]) {
        return 100;
    }else {
        return 44;
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (cell.frame.size.height == 44) {
        [self.selectArray setObject:@"100" forKey:indexPath];
    }else {
        [self.selectArray removeObjectForKey:indexPath];
    }
    [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}

 

---恢复内容结束---

TableViewCell自定义折叠

原文:http://www.cnblogs.com/developzhou/p/5036575.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!