Using [UIColor colorWithRed:green:blue:alpha:] doesn't work with UITableView seperatorColor?

前端 未结 4 1506
天命终不由人
天命终不由人 2020-11-29 20:10

I\'m trying to configure a dark gray seperator color. Why does the following do nothing?

self.tableView.seperatorStyle = UITableViewCellSeperatorStyleSingleL         


        
4条回答
  •  醉梦人生
    2020-11-29 20:51

    There are two new methods in UIColor that accept integer values from 0 to 255:

    UIColor(red: Int, green: Int, blue: Int)
    

    and

    UIColor(alpha: Float, red: Int, green: Int, blue: Int)
    

    It's not in the documentation but I've used it and it works like a charm.

提交回复
热议问题