UIPickerView:NSAttributedString在iOS 7中不可用?

栏目: IOS · 发布时间: 5年前

内容简介:这个问题的唯一解决方案显然是使用pickerView:viewForRow:forComponent:reusingView:并返回带有属性文本的UILabel,因为Apple显然已禁用使用属性字符串.翻译自:https://stackoverflow.com/questions/18945119/uipickerview-nsattributedstring-not-available-in-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://stackoverflow.com/questions/18945119/uipickerview-nsattributedstring-not-available-in-ios-7


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Handbook of Data Structures and Applications

Handbook of Data Structures and Applications

Dinesh P. Mehta / Chapman and Hall/CRC / 2004-10-28 / USD 135.95

In the late sixties, Donald Knuth, winner of the 1974Turing Award, published his landmark book The Art of Computer Programming: Fundamental Algorithms. This book brought to- gether a body of kno......一起来看看 《Handbook of Data Structures and Applications》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具