Ok, maybe I\'m missing something really simple and I apologize if that\'s the case, however, I\'ve googled every permutation of the title and have not found! So this is sim
Swift version of @alessandro-pirovano answer
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let rowSize = pickerView.rowSize(forComponent: component)
let width = rowSize.width
let height = rowSize.height
let frame = CGRect(x: 0, y: 0, width: width, height: height)
let label = UILabel(frame: frame)
label.textAlignment = .center
label.text = rows[row]
return label
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
guard let label = pickerView.view(forRow: row, forComponent: component) as? UILabel else {
return
}
label.backgroundColor = .orange
}