最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift中在初始化时设置表格单元选中的背景色

iOS crifan 1791浏览 0评论

此处,要去设置:

在初始化的时候,不是后来的选中的时候,

去设置,单元格的被选中的背景色

把文字变成白色

后来参考之前的:

[已解决]swift在初始化时设置表格单元选中后的颜色

直接去添加颜色的设置:

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        if indexPath.row == self.curSelectIdx {

            curCell.contentView.backgroundColor = CommonButtonColor

            curCell.textLabel?.textColor = UIColor.whiteColor()

        }

}

即可:

转载请注明:在路上 » [已解决]swift中在初始化时设置表格单元选中的背景色

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.172 seconds, using 22.02MB memory