小编kmp*_*mp3的帖子

在iOS 6之前NSAttributedString是否可用?

我发现有关6版之前的iOS版本的NSAttributedString可用性的相互矛盾的信息.如果它有点向后兼容,那么它将非常有用.

这里说它从iOS 4开始可用: 为什么iPhone上没有NSAttributedString?

在Apple网站上,它说iOS 6及更高版本:https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/Reference/Reference.html

我尝试在我的代码中实现它,如下所示:

NSAttributedString *commentString = [[NSAttributedString alloc] initWithString:@"I really love raisins" attributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}];
Run Code Online (Sandbox Code Playgroud)

它适用于iOS 6,但是当我尝试在iOS 5或iOS 5.1中运行它时.我没有测试过早期版本.

我只是想尝试使用旧版本中未包含的功能吗?

objective-c ios ios5 ios6

9
推荐指数
2
解决办法
6475
查看次数

标签 统计

ios ×1

ios5 ×1

ios6 ×1

objective-c ×1