I use the following func to change the font color and font size, the color works but the font name and font size refuse to work.
func pickerView(pickerVi
To further elaborate on https://stackoverflow.com/users/4020910/bennythenerd answer with UILabel I'd go with a bit more memory optimised solution that reuses the labels:
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let pickerLabel: UILabel
if let label = view as? UILabel {
pickerLabel = label
} else {
pickerLabel = UILabel()
pickerLabel.font = UIFont(name: "Rubik-Regular", size: 22)
pickerLabel.textAlignment = .center
}
pickerLabel.text = pickerData[row] //This is your string
return pickerLabel
}