码迷,mamicode.com
首页 > 其他好文 > 详细

TableViewCell自定义折叠

时间:2015-12-10 19:03:14      阅读:153      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!