Schrift ändern in meinem picker Versuch NSAttributedString mit:Schrift NSAttributedString mit Einstellung
public func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
guard let castDict = self.castDict else {
return nil
}
let name = [String](castDict.keys)[row]
switch component {
case 0:
return NSAttributedString(string: name, attributes: [NSForegroundColorAttributeName : AppColors.Rose.color, NSFontAttributeName : UIFont.boldSystemFont(ofSize: 14)])
case 1:
guard let character = castDict[name] else {
return NSAttributedString(string: "Not found character for \(name)", attributes: [NSForegroundColorAttributeName : AppColors.Rose.color, NSFontAttributeName : UIFont.boldSystemFont(ofSize: 14)])
}
return NSAttributedString(string: character, attributes: [NSForegroundColorAttributeName : AppColors.LightBlue.color, NSFontAttributeName : UIFont.boldSystemFont(ofSize: 14)])
default:
return nil
}
}
Farbe geändert, Schriftart - nicht:
Was mache ich falsch?
Dank für die ausführliche Antwort. Ja, mit der benutzerdefinierten Ansicht. Versuchen Sie immer, keine Ansichten zum Zweck der Leistung zu verwenden – zzheads