您的位置:首页 > 产品设计 > UI/UE

UITableView 点击展开的实现

2015-10-16 11:06 441 查看
推介看下这里的 内容 http://www.cnblogs.com/kenshincui/p/3931948.html
IOS8 above

UITabliViewCell 利用 autolayout 实现的,这里就不多说了

主要代码

1.

self.tableView.rowHeight = UITableViewAutomaticDimension;

self.tableView.estimatedRowHeight = 70;

2.

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{

NSLog(@"heightForRowAtIndexPath=:%ld",indexPath.row);

if( indexPath.row == selectIndex )

{

if( !isOpened )

return 130;

return UITableViewAutomaticDimension;

}

else

{

return 130;

}

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

selectIndex = indexPath.row;

isOpened = !isOpened;

[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: