Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show an HTML string on a UILabel in iOS?
    primarykey
    data
    text
    <p>I am getting a title in HTML format as </p> <p>&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;strong&gt;Example &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;</p> <p>I need to show this HTML string in a UILabel. The color code and the font size should be same as the coming in HTML. When I am converting the HTML string into a NSString, only the text "Example" is coming, and not the color.</p> <p>Is there any solution?</p> <p>Thnx in advance</p> <p>Till now I am trying by using a NSAttributedString in following way but by this way the whole HTML is printing:</p> <pre><code>UIFont *font = [UIFont systemFontOfSize:14.0]; UIFont *secondFont = [UIFont systemFontOfSize:10.0]; NSMutableDictionary *firstAttributes; NSMutableDictionary *secondAttributes; NSDictionary *firstAttributeFont = @{NSFontAttributeName:font}; NSDictionary *secondAttributeFont = @{NSFontAttributeName:secondFont}; [firstAttributes addEntriesFromDictionary:firstAttributeFont]; [secondAttributes addEntriesFromDictionary:secondAttributeFont]; [firstAttributes addEntriesFromDictionary:@{NSForegroundColorAttributeName:[UIColor clearColor]}]; [secondAttributes addEntriesFromDictionary:@{NSForegroundColorAttributeName:[UIColor clearColor]}]; NSString* completeString = [NSString stringWithFormat:@"%@",strTitle]; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:completeString]; [attributedString setAttributes:firstAttributes range:[completeString rangeOfString:strTitle]]; // [attributedString setAttributes:secondAttributes range:[completeString rangeOfString:self.secondAttributeText]]; Cell.lbl_Title.attributedText = attributedString; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload