Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 iOS 5 上运行 setAttributedTitle 有什么技巧吗?那是 iOS6 功能,但我需要向后兼容。
当我在 iOS 5 上使用它时
[self setAttributedTitle:mutableString forState:UIControlStateNormal];
我收到错误:
[UIButton setAttributedTitle:forState:]: unrecognized selector sent to instance
最简单的方法可能是查看创建自定义按钮并使用DTCoreText创建标签 ( DTAttributedLabel) 以进入它。
DTAttributedLabel