0
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cellFrame = CGRectMake(0, 0, tableView.frame.width, 100)
var retCell = UITableViewCell(frame: cellFrame)
var textView = UITextView(frame: CGRectMake(8,30,tableView.frame.width-8-8,65))
textView.layer.borderColor = UIColor.blueColor().CGColor
textView.layer.borderWidth = 1
retCell.addSubview(textView)
if(reqGrpIndex == 0){
reqGrpIndex = reqGrpIndex + 1
}
}
为什么我们不应该在这个函数上添加子视图?如何将代码更改为实现相同目的的良好实践?避免在cellforrowatindexpath上添加子视图
所以我应该使用自定义单元格?每个单元格的视图在我的应用程序中都不相同。 – henry
您应该提供信息以帮助您解决问题。 :) –
例如,我有两种情况的单元格,情况A:显示按钮。案例B:显示textview。 – henry