Custom Objects

This demonstrates usage of the <object> tag for embedding your own views

or

These views are writting in HTML like this:

<object style="display:inline;margin-bottom:1em;" someColorParameter="red" width=100 height=20></object>

You provide your own custom view in the -attributedTextContentView:viewForAttachment:frame: method.

if (attachment isKindOfClass:[DTTextAttachmentObject class])
{
  // 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;
}

Object tags can access their childNodes

	<object height=100 width=100>
		<special stuff="bla" />
	</object>
	

When creating the custom view for this object you access the text attachment childNodes to get special information you have put there in addition to the attributes