Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (25 sloc) 1.11 KB
pre { color:gray; }
<h2>Custom Objects</h2>
<p>This demonstrates usage of the &lt;object&gt; tag for embedding your own views</p>
<p><object style="display:inline;margin-bottom:1em;" someColorParameter="red" width=100 height=20></object>
or <object style="display:inline;margin-bottom:1em;" someColorParameter="green" width=100 height=20></object></p>
<p>These views are writting in HTML like this:</p>
<pre>&lt;object style="display:inline;margin-bottom:1em;" someColorParameter="red" width=100 height=20&gt;&lt;/object&gt;</pre>
<p>You provide your own custom view in the <b>-attributedTextContentView:viewForAttachment:frame:</b> method.</p>
<pre>if (attachment.contentType == DTTextAttachmentTypeObject)
// somecolorparameter has a HTML color
UIColor *someColor = [UIColor colorWithHTMLName:[attachment.attributes objectForKey:@"somecolorparameter"]];
UIView *someView = [[UIView alloc] initWithFrame:frame];
someView.backgroundColor = someColor;
someView.layer.borderWidth = 1;
someView.layer.borderColor = [UIColor blackColor].CGColor;
return someView;
Something went wrong with that request. Please try again.