【发布时间】:2015-09-22 13:28:00
【问题描述】:
每当点击特定单元格时,我试图让 UITableViewCell 显示有关特定单元格的更多内容。一旦单元格膨胀并再次被轻敲,单元格应收缩回其原始大小。
我很确定必须对代表 heightForRowAtIndexPath 和 didSelectRowAtIndexPath 做一些事情,但我不知道如何使用 didSelectRowAtIndexPath 选择特定的表格单元格行。
// Height of table cell rows
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 45
}
//On cell tap, expand
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.tableView.rowHeight = 75;
}
另外,是否可以隐藏从父单元格溢出的任何内容?有点像溢出:隐藏;在 CSS 中。
【问题讨论】:
标签: ios swift uitableview cocoa-touch delegates