相关疑难解决方法(0)

你如何使用NSAttributedString?

多种颜色NSStringNSMutableStrings不可能.所以我听说过一些关于iPad SDK 3.2(或3.2左右)NSAttributedString引入的内容,并且可以在iPhone SDK 4.0 beta版iPhone上获得.

我想要一个有三种颜色的字符串.

我不使用3个单独的NSStrings的原因是因为三个NSAttributedString子串中的每个子串的长度经常变化,所以我更喜欢,不使用任何计算来重新定位3个单独的NSString对象.

如果可以使用NSAttributedString我如何进行以下操作 - (如果不能使用NSAttributed字符串,你会怎么做):

替代文字

编辑: 请记住,@"first",@"second"@"third"会在任何时间其他字符串替换.因此,使用硬编码的NSRange值将不起作用.

textcolor nsattributedstring ios4 ios

305
推荐指数
7
解决办法
23万
查看次数

iphone/ipad:究竟如何使用NSAttributedString?

是的,很多人都在谈论iPhone/iPad上的Rich Text,很多人都知道NSAttributedString.

但如何使用NSAttributedString?我搜索了很多时间,没有提取线索.

我知道如何设置NSAttributedString,然后我应该怎么做才能在iPhone/iPad上显示富文本文本?

官方文档称它应该与之一起使用CoreText.Framework,这意味着什么?

有这样简单的方法吗?

NSAttributedString *str;
.....
UILabel *label;
label.attributedString = str;
Run Code Online (Sandbox Code Playgroud)

iphone nsattributedstring ipad

102
推荐指数
7
解决办法
9万
查看次数

标签 统计

nsattributedstring ×2

ios ×1

ios4 ×1

ipad ×1

iphone ×1

textcolor ×1