Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Options for HTML

Render HTML with options.
  • Loading branch information...
commit bfae5291a9f11fb6f0a5f18dc512481d5d3d6aa9 1 parent 33e3679
@depl0y depl0y authored
View
9 Core/Source/DTAttributedTextCell.h
@@ -47,6 +47,15 @@
*/
- (void)setHTMLString:(NSString *)html;
+/**
+ This method allows to set HTML text directly as content of the receiver.
+
+ This will be converted to an attributed string.
+ @param html The HTML string to set as the receiver's text content
+ @param options The options used for rendering the HTML
+ */
+- (void) setHTMLString:(NSString *)html options:(NSDictionary*) options;
+
/**
@name Getting Information
View
9 Core/Source/DTAttributedTextCell.m
@@ -194,7 +194,11 @@ - (void)setSelected:(BOOL)selected animated:(BOOL)animated
- (void)setHTMLString:(NSString *)html
{
- // we don't preserve the html but compare it's hash
+ [self setHTMLString:html options:nil];
+}
+
+- (void) setHTMLString:(NSString *)html options:(NSDictionary*) options {
+
NSUInteger newHash = [html hash];
if (newHash == _htmlHash)
@@ -205,10 +209,11 @@ - (void)setHTMLString:(NSString *)html
_htmlHash = newHash;
NSData *data = [html dataUsingEncoding:NSUTF8StringEncoding];
- NSAttributedString *string = [[NSAttributedString alloc] initWithHTMLData:data documentAttributes:NULL];
+ NSAttributedString *string = [[NSAttributedString alloc] initWithHTMLData:data options:options documentAttributes:NULL];
self.attributedString = string;
[self setNeedsLayout];
+
}
- (void)setAttributedString:(NSAttributedString *)attributedString
Please sign in to comment.
Something went wrong with that request. Please try again.