2012-10-16 23 views
0

可能重复:
UILabel text Issue in iphone如何在iphone中多行uilabel中加粗特殊字词?

我有以下这样的文字, 例子: 信息详细说明:如果用户FB签将获得20%的折扣,如果共享此报价在twitter上将获得商家30%的折扣。

我上面的例子我想使'提供详细信息'只是我想要经常的文本大胆的休息。 我怎么能做到这一点,我应用很多效果来实现这一点,但无法为此得到适当的解决方案。请帮我实现这一点。

+0

这实际上出现在另一个问题在这里 - http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel – Kolors

回答

0

在单个标签中,如果您希望您可以执行以下操作来制作特定标签粗体,则无法替代此选项。

UILabel* myBoldlabel= [[UILabel alloc] init]; 
[email protected]"Offer Details"; 
myBoldlabel.font = [UIFont boldSystemFontOfSize:16.0f]; 
UILabel* finalLabel=[[UILabel alloc] init]; 
finalLabel.text=[NSString stringWithFormat:@"%@:,if users checkin from fb will get 20% discount and if share the this offers on twitter will get 30 % discount from businesses",myBoldlabel];// You can place %@ anywhere in the sentence... 
finalLabel.numberOfLines=2; 

如果你愿意将任何特定的字体,你也可以添加此方式 - :

myBoldlabel.font = [UIFont fontWithName:@"TrebuchetMS-Bold" size:18]; 

希望这有助于你。

+0

感谢您的解决方案,但解决方案真的不工作。 – user196320