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

前端 未结 4 1548
天命终不由人
天命终不由人 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:54

    You have to divide your values with 255, because the range is 0-1. Take 127/255 = 0.49f and type in that instead. It's there, it's just white :)

    edit: cause of comments, I added some code as to how I solve it:

    -(float)getRGBValue:(int) rgbValue{  
        return rgbValue/255.0;
    ]
    

提交回复
热议问题