Date un'occhiata a: http://makeapppie.com/tag/uipickerview-in-swift/
Se si desidera cambiare il colore del titolo di ogni elemento è possibile implementare:
func pickerView(pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
let titleData = pickerData[row]
var myTitle = NSAttributedString(string: titleData, attributes: [NSFontAttributeName:UIFont(name: "Georgia", size: 15.0)!,NSForegroundColorAttributeName:UIColor.whiteColor()])
return myTitle
}
Swift 3:
func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
let titleData = pickerData[row]
let myTitle = NSAttributedString(string: titleData!, attributes: [NSFontAttributeName:UIFont(name: "Georgia", size: 15.0)!,NSForegroundColorAttributeName:UIColor.white])
return myTitle
}
fonte
2015-03-25 08:53:12
Cambiare il colore di ciò: il carattere, lo sfondo, la voce selezionata, gli elementi non selezionati? –