UIPickerView:NSAttributedString在iOS 7中不可用?

前端之家收集整理的这篇文章主要介绍了UIPickerView:NSAttributedString在iOS 7中不可用?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
似乎UIPickerView不再支持将NSAttributedString用于选择器视图项.谁能证实这一点?我在UIPickerView.h文件中找到了NS_AVAILABLE_ IOS(6_0),但这是问题吗?有没有办法解决这个问题,还是我运气不好?
- (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;

解决方法

这个问题的唯一解决方案显然是使用pickerView:viewForRow:forComponent:reusingView:并返回带有属性文本的UILabel,因为Apple显然已禁用使用属性字符串.
原文链接:https://www.f2er.com/iOS/333067.html

猜你在找的iOS相关文章