我無法寫出下面的代碼在xcod4.2與模擬器5.0告訴我另一種解決方案如何在模擬器5.0中將NSAttributedString對象設置爲xcode4.2中的uilabel?
NSMutableAttributedString *str=[[NSMutableAttributedString alloc] initwithString:@"This is Green and Red"];
NSDictionary *[email protected]{NSForeGroundColorAttributeName:[UIColor redColor]};
NSDictionary *[email protected]{NSForeGroundColorAttributeName:[UIColor greenColor]};
[str setAttribute:greenatt range:NSMakeRange(9,5)];
[str setAttribute:redatt range:NSMakeRange(19,3)];
lbl.attributedText=str;
什麼是你想實現的,使用上面的代碼? – Max
你看過你收到的錯誤,說了什麼? – Wain
錯誤:UILabel歸檔文本在xcode4.2中不可用。 –