这个方法实现headerView的
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
//账户信息
var cell: UserSettingCell
cell = tableView.dequeueReusableCellWithIdentifier("AccountManageSection") as! UserSettingCell
if section == 0{
// cell.userName.text = "当前登录账号".localized()
cell.labelUserName.text = "当前登录账号".localized()
}else if section == 1{
// cell.userName.text = "可切换的账号".localized()
cell.labelUserName.text = "可切换的账号".localized()
}
// return cell.contentView
return cell
}
解决方法:把return cell 改成:
return cell.contentView