DTAttributedTextView Class Reference
| Inherits from | UIScrollView | 
| Declared in | DTAttributedTextView.h | 
Overview
This view is designed to be a replacement for UITextView. It is a UIScrollView subclass and creates a DTAttributedTextContentView as content view for displaying the text.
The content view of type DTAttributedTextContentView is created lazily. You should not set values on it directly if you use it in conjunction with this class for scrolling.
Tasks
Providing Content
- 
	
		
attributedStringproperty - 
	
		
textDelegateproperty - 
	
		
– relayoutText 
Accessing Subviews
- 
	
		
attributedTextContentViewproperty - 
	
		
backgroundViewproperty 
Customizing Display
- 
	
		
shouldDrawLinksproperty - 
	
		
shouldDrawImagesproperty 
Customizing Content View
User Interaction
Working with a Cursor
Properties
attributedString
The attributed text to be displayed in the text content view of the receiver.
@property (nonatomic, strong) NSAttributedString *attributedStringDeclared In
DTAttributedTextView.hattributedTextContentView
References to the DTAttributedTextContentView that display the text. This is not named contentView because this class inherits from UIScrollView which has an internal property of this name
@property (nonatomic, strong, readonly) DTAttributedTextContentView *attributedTextContentViewDeclared In
DTAttributedTextView.hbackgroundView
A view to be displayed behind the text content view
@property (nonatomic, strong) IBOutlet UIView *backgroundViewDeclared In
DTAttributedTextView.hshouldDrawImages
If the content view of the receiver should draw images. Set to NO if displaying images as custom views via textDelegate;
@property (nonatomic, assign) BOOL shouldDrawImagesDiscussion
Defaults to YES if you supply your own image drawing then set this property to NO and supply your custom image view (e.g. DTLazyImageView) via the textDelegate.
Declared In
DTAttributedTextView.hshouldDrawLinks
If the content view of the receiver should draw links. Set to NO if displaying links as custom views via textDelegate;
@property (nonatomic, assign) BOOL shouldDrawLinksDiscussion
Defaults to YES if you supply your own link drawing  then set this property to NO and supply your custom view (e.g. DTLinkButton) via the textDelegate.
Declared In
DTAttributedTextView.htextDelegate
A delegate implementing DTAttributedTextContentViewDelegate to provide custom subviews for images and links.
@property (nonatomic, DT_WEAK_PROPERTY) IBOutlet id<DTAttributedTextContentViewDelegate> textDelegateDeclared In
DTAttributedTextView.hInstance Methods
classForContentView
You can override this method to provide a different class to use for the content view. If you replace the content view class then it should inherit from DTAttributedTextContentView which is also the default.
- (Class)classForContentViewReturn Value
The class to use for the content view.
Declared In
DTAttributedTextView.hclosestCursorIndexToPoint:
Determines the closest string index to a point in the receiver’s frame.
- (NSInteger)closestCursorIndexToPoint:(CGPoint)pointParameters
- point
 The point
Return Value
The resulting string index
Discussion
This can be used to find the cursor position to position an input caret at.
Declared In
DTAttributedTextView.hcursorRectAtIndex:
The rectangle to draw a caret for a given index
- (CGRect)cursorRectAtIndex:(NSInteger)indexParameters
- index
 The string index for which to determine a cursor frame
Return Value
The cursor rectangle
Declared In
DTAttributedTextView.hrelayoutText
Performs a new layout pass on the receiver. This destroys the frame setter, calls relayoutText on the content view and marks the receiver as needing layout so that custom subviews get appropriately sized.
- (void)relayoutTextDeclared In
DTAttributedTextView.hscrollRangeToVisible:animated:
Scrolls the receiver until the text in the specified range is visible.
- (void)scrollRangeToVisible:(NSRange)range animated:(BOOL)animatedParameters
- range
 The range of text to scroll into view.
- animated
 YESif the movement should be animated.
Declared In
DTAttributedTextView.hscrollToAnchorNamed:animated:
Scrolls the receiver to the anchor with the given name to the top.
- (void)scrollToAnchorNamed:(NSString *)anchorName animated:(BOOL)animatedParameters
- anchorName
 The name of the href anchor.
- animated
 YESif the movement should be animated.
Declared In
DTAttributedTextView.h