不理解为什么给自定义Cell成员变量赋值时一定要在重写的 layoutSubviews 里才能值到值,要不然是空的!
dic=dataArray[indexPath.row] as NSDictionary //取得值
var cell:CsCell=table.dequeueReusableCellWithIdentifier(str, forIndexPath: indexPath) as CsCell
// println(dic)
cell.dic=dic//给Cell 里的dic 赋值。
在自定义Cell里
//一定要在这里面取值才可以。
override func layoutSubviews()
{
name.text=dic["username"] as? String
}
override func awakeFromNib()//在这里面取dic是空的
override init(style: UITableViewCellStyle, reuseIdentifier: String?)//在这里面取dic是空的
不理解,做一下记录。