
我很确定必须使用委托heightForRowAtIndexPath和dIDSelectRowAtIndexPath完成某些 *** 作,但我不知道如何使用dIDSelectRowAtIndexPath选择特定的表格单元格行.
// Height of table cell rowsfunc tableVIEw(tableVIEw: UItableVIEw,heightForRowAtIndexPath indexPath: NSIndexPath) -> CGfloat { return 45}//On cell tap,expandfunc tableVIEw(tableVIEw: UItableVIEw,dIDSelectRowAtIndexPath indexPath: NSIndexPath) { self.tableVIEw.rowHeight = 75;} 此外,是否可以隐藏从父单元溢出的任何内容?有点像溢出:隐藏;在CSS中.
解决方法 在dIDSelectRowAtIndexPath中选择的tablevIEw上声明一个全局变量NSInteger类型和存储行,并在此处重新加载.在heightForRowAtIndexPath中检查行并在那里增加高度.试试这样
var selectedindex : NSInteger! = -1 //Delecre this global func tableVIEw(tableVIEw: UItableVIEw,dIDSelectRowAtIndexPath indexPath: NSIndexPath) { if indexPath.row == selectedindex{ selectedindex = -1 }else{ selectedindex = indexPath.row } tableVIEw.reloadData()}func tableVIEw(tableVIEw: UItableVIEw,heightForRowAtIndexPath indexPath: NSIndexPath) -> CGfloat { if indexPath.row == selectedindex { return 75 }else{ return 45 }} 总结 以上是内存溢出为你收集整理的ios – 如何更改UITableViewCell的高度?全部内容,希望文章能够帮你解决ios – 如何更改UITableViewCell的高度?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)