@clifford
Для того, чтобы сменить цвет текста в UIPickerView, можно использовать метод attributedTitleForRow
в сочетании с классом NSAttributedString
. Например:
1 2 3 4 5 6 7 8 |
func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { let title = "Some Title" let attributes: [NSAttributedString.Key: Any] = [ .foregroundColor: UIColor.blue ] let attributedString = NSAttributedString(string: title, attributes: attributes) return attributedString } |
В этом примере текст будет отображаться синим цветом. Вместо UIColor.blue
можно использовать любой другой цвет, описанный в классе UIColor.