UIPickerViewはピッカービュー項目のNSAttributedStringの使用をサポートしていないようです。誰でもこれを確認できますか? UIPickerView.h
ファイルにNS_AVAILABLE_IOS(6_0)
が見つかりましたが、これは問題ですか?これの周りに道があるのですか、または私は幸運の外ですか?UIPickerView:NSAttributedStringはiOS 7では使用できません。
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component NS_AVAILABLE_IOS(6_0); // attributed title is favored if both methods are implemented
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view;
帰属文字列を指定するとどうなりますか?どのようにサポートされていませんか? – Wain
私の謝罪私はおそらくこれを言及していたはずです。それは完璧に動作しますが、pickerViewはiOS 7の指定されたフォントでは表示しません。システムのデフォルトを使用します。 iOS 6では、これは想定されるフォントで表示されます。 – Rob
別の方法として属性付きテキストのラベルを返そうとしましたか? – Wain