【问题标题】:How to show HTML text from API in Objective C?如何在Objective C中显示来自API的HTML文本?
【发布时间】:2017-10-25 14:58:30
【问题描述】:

我正在从 API 获取一个字符串,即“http://www.maximusautogroup.com/\”target=\“_blank\">here”。从这个字符串中,我必须将“here”显示为超链接那个链接。我不知道怎么做。

【问题讨论】:

标签: ios objective-c iphone


【解决方案1】:

试试这个:

   NSString *FileName = [[Url lastPathComponent] stringByDeletingPathExtension];
  NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:FileName];
[attributeString addAttributes:@{NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle)
     , NSBackgroundColorAttributeName: [UIColor blueColor]} range:NSMakeRange(0, [attributeString length])]

        [_buyButton setAttributedTitle:attributeString forState:UIControlStateNormal];

【讨论】:

    猜你喜欢
    • 2018-07-27
    • 2011-05-07
    • 1970-01-01
    • 2021-09-12
    • 2017-07-08
    • 2017-03-07
    • 2012-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多