在IOS7 iphone中显示html标记值

在IOS7 iphone中显示html标记值,iphone,href,Iphone,Href,嗨,我正在开发小型iPhone应用程序。我从服务器上得到的字符串如下 You can download the MyApp on the Google Play store:<a href='https://play.google.com/store/apps/details?id=com.myapp' style='display:inline-block;padding:0px;margin-left:10px'>MyApp</a>", 您可以在Google Pla

嗨,我正在开发小型iPhone应用程序。我从服务器上得到的字符串如下

You can download the MyApp on the Google Play store:<a href='https://play.google.com/store/apps/details?id=com.myapp' style='display:inline-block;padding:0px;margin-left:10px'>MyApp</a>",
您可以在Google Play商店下载MyApp:“,
我想用MyApp文本作为链接将其显示为普通字符串。如何做到这一点。是否有任何方法可以做到这一点。 需要帮助,谢谢

我试过了,但还是不起作用

NSAttributedString* attrStr = [[NSAttributedString alloc]
                               initWithString:@“You can download the MyApp on the Google Play store:<a href='https://play.google.com/store/apps/details?id=com.myapp' style='display:inline-block;padding:0px;margin-left:10px'>MyApp</a>"

                               attributes:[cell.answer.attributedText attributesAtIndex:0 effectiveRange:NULL]];
cell.answer.attributedText = attrStr;
nsattributestring*attrStr=[[nsattributestring alloc]
initWithString:@“您可以在Google Play商店下载MyApp:”
属性:[cell.answer.AttributeText attributesAtIndex:0 effectiveRange:NULL]];
cell.answer.attributeText=attrStr;
只有“普通标签”是无法做到的


尝试使用
NSAttributedString
或将HTML代码放入
UIWebView
中,然后显示它

我建议你去看看

编辑

使用NSAttribute字符串

NSMutableAttributedString * appLabelString = [[NSMutableAttributedString alloc] initWithString:@"You can download the MyApp on the ...."];
[appLabelString addAttribute: NSLinkAttributeName value: @"http://www.itunes.com" range: NSMakeRange(21, 26)];
appLabel.attributedText = appLabelString;

NSAttributedString
UIWebView
?我正在使用普通NSString,而不是在webview中显示。它只是普通标签。
NSAttributedString
所以。你好,kaiusee谢谢你的快速重播。我不想为此使用webview。是否有其他解决方案。如果你不想使用webview(我不喜欢一直使用它)我建议你看看OHAttributedLabel。在这里阅读它可以做什么:是的,我检查了它,但它已被弃用,因为IOS6我也想在IOS7中使用它:(检查我的编辑@nilkash@nilkash您可能需要根据文本更改范围,但这只是一个示例