Public Member Functions | |
Accessing MVC components | |
(HFController *) | - controller |
(void) | - setController: |
(HFLayoutRepresenter *) | - layoutRepresenter |
(void) | - setLayoutRepresenter: |
(HFByteArray *) | - byteArray |
Display configuration | |
(void) | - setBackgroundColors: |
(NSArray *) | - backgroundColors |
(void) | - setBordered: |
(BOOL) | - bordered |
Delegate handling | |
(void) | - setDelegate: |
(id) | - delegate |
Accessing contents as NSData | |
(NSData *) | - data |
(void) | - setData: |
- (HFController *) controller |
Returns the HFController for the receiver. You may want to access this to add or remove HFRepresenters from the text view at runtime.
- (void) setController: | (HFController *) | controller |
Sets the HFController for the receiver. An HFTextView comes with its own HFController, but you can use this to replace it.
- (HFLayoutRepresenter *) layoutRepresenter |
Returns the HFLayoutRepresenter for the receiver. You may want to access this to add or remove HFRepresenters from the text view at runtime.
- (void) setLayoutRepresenter: | (HFLayoutRepresenter *) | layoutRepresenter |
Sets the HFLayoutRepresenter for the receiver. An HFTextView comes with its own HFLayoutRepresenter, but you can use this to replace it.
- (HFByteArray *) byteArray |
Returns the HFByteArray for the receiver. This is equivalent to [[self controller] byteArray]
.
- (void) setBackgroundColors: | (NSArray *) | colors |
Sets the arry of background colors for the receiver. The background colors are used in sequence to draw each row.
- (NSArray *) backgroundColors |
Returns the array of background colors for the receiver.
- (void) setBordered: | (BOOL) | val |
Sets whether the receiver draws a border.
- (BOOL) bordered |
Returns whether the receiver draws a border.
- (void) setDelegate: | (id) | delegate |
Sets the delegate, which may implement the methods in HFTextViewDelegate
- (id) delegate |
Returns the delegate, which is initially nil.
- (NSData *) data |
Returns the contents of the HFTextView's HFByteArray as an NSData This NSData proxies an HFByteArray, and therefore it is usually more efficient than naively copying all of the bytes. However, access to the -byte
method will necessitate copying, a potentially expensive operation. Furthermore, the NSData API is inherently 32 bit in a 32 bit process. Lastly, there is no protection if the backing file for the data disappears.
For those reasons, this should only be used when its convenience outweighs the downside (e.g. some bindings scenarios). For most use cases, it is better to use the -byteArray
method above.
- (void) setData: | (NSData *) | data |
Sets the contents of the HFTextView's HFByteArray to an NSData
. Note that the data is copied via the -copy
message, so prefer to pass an immutable NSData
when possible.