Click here to support Nimbus development and make a donation at www.pledgie.com !
An iOS framework whose growth is bounded by O(documentation).
NIAttributedLabel Class Reference

Overview

A UILabel that utilizes NSAttributedString to format its text.

Definition at line 33 of file NIAttributedLabel.h.

Inherits UILabel.

Methods

NSAttributedString * attributedString property
BOOL autoDetectLinks property
UIColor * linkColor property
UIColor * linkHighlightColor property
BOOL linksHaveUnderlines property
CTUnderlineStyle underlineStyle property
CTUnderlineStyleModifiers underlineStyleModifier property
CGFloat strokeWidth property
UIColor * strokeColor property
CGFloat textKern property
IBOutlet id
< NIAttributedLabelDelegate
delegate property
(void) - addLink:range:
(void) - removeAllExplicitLinks
(void) - setTextColor:range:
(void) - setFont:range:
(void) - setUnderlineStyle:modifier:range:
(void) - setStrokeWidth:range:
(void) - setStrokeColor:range:
(void) - setTextKern:range:

Method Documentation

- (NSAttributedString *) attributedString [read, write, copy]

The attributed string that will be displayed.

Setting this property explicitly will ignore the UILabel's existing style.

If you would like to adopt the existing UILabel style then use setText:. The attributedString will be created with the UILabel's style. You can then create a mutable copy of the attributed string, modify it, and then assign the new attributed string back to this label.

Definition at line 45 of file NIAttributedLabel.h.

- (BOOL) autoDetectLinks [read, write, assign]

Whether to automatically detect links in the string.

Link detection is deferred until the label is displayed for the first time. If the text changes then all of the links will be cleared and re-detected when the label displays again.

Definition at line 53 of file NIAttributedLabel.h.

- (UIColor *) linkColor [read, write, retain]

The color of detected links.

If no color is set, the default is [UIColor blueColor].

Definition at line 75 of file NIAttributedLabel.h.

- (UIColor *) linkHighlightColor [read, write, retain]

The color of the link's background when touched/highlighted.

If no color is set, the default is [UIColor colorWithWhite:0.5 alpha:0.2] If you do not want to highlight links when touched, set this to [UIColor clearColor] or set it to the same color as your view's background color (opaque colors will perform better).

Definition at line 85 of file NIAttributedLabel.h.

- (BOOL) linksHaveUnderlines [read, write, assign]

Whether or not links should have underlines.

By default this is NO.

This affects all links in the label.

Definition at line 94 of file NIAttributedLabel.h.

- (CTUnderlineStyle) underlineStyle [read, write, assign]

The underline style for the whole text.

Value:

  • kCTUnderlineStyleNone (default)
  • kCTUnderlineStyleSingle
  • kCTUnderlineStyleThick
  • kCTUnderlineStyleDouble

Definition at line 105 of file NIAttributedLabel.h.

- (CTUnderlineStyleModifiers) underlineStyleModifier [read, write, assign]

The underline style modifier for the whole text.

Value:

  • kCTUnderlinePatternSolid (default)
  • kCTUnderlinePatternDot
  • kCTUnderlinePatternDash
  • kCTUnderlinePatternDashDot
  • kCTUnderlinePatternDashDotDot

Definition at line 117 of file NIAttributedLabel.h.

- (CGFloat) strokeWidth [read, write, assign]

The stroke width for the whole text.

Positive numbers will render only the stroke, where as negative numbers are for stroke and fill.

Definition at line 126 of file NIAttributedLabel.h.

- (UIColor*) strokeColor [read, write, retain]

The stroke color for the whole text.

Definition at line 131 of file NIAttributedLabel.h.

- (CGFloat) textKern [read, write, assign]

The text kern for the whole text.

The text kern indicates how many points the following character should be shifted from its default offset.

A positive kern indicates a shift farther away from and a negative kern indicates a shift closer

Definition at line 142 of file NIAttributedLabel.h.

- (IBOutlet id<NIAttributedLabelDelegate>) delegate [read, write, assign]

The attributed label notifies the delegate of any user interactions.

Definition at line 211 of file NIAttributedLabel.h.

- (void) addLink: (NSURL *)  urlLink
range: (NSRange)  range 

Adds a link at a given range.

Adding any links will immediately enable user interaction on this label. Explicitly added links are removed whenever the text changes.

Definition at line 199 of file NIAttributedLabel.m.

- (void) removeAllExplicitLinks

Removes all explicit links from the label.

If you wish to remove automatically-detected links, set autoDetectLinks to NO.

Definition at line 213 of file NIAttributedLabel.m.

- (void) setTextColor: (UIColor *)  textColor
range: (NSRange)  range 

Sets the text color for a given range.

Note that this will not change the overall text Color value and textColor will return the default text color.

Definition at line 281 of file NIAttributedLabel.m.

- (void) setFont: (UIFont *)  font
range: (NSRange)  range 

Sets the font for a given range.

Note that this will not change the default font value and font will return the default font.

Definition at line 297 of file NIAttributedLabel.m.

- (void) setUnderlineStyle: (CTUnderlineStyle)  style
modifier: (CTUnderlineStyleModifiers)  modifier
range: (NSRange)  range 

Sets the underline style and modifier for a given range.

Note that this will not change the default underline style.

Style Values:

  • kCTUnderlineStyleNone (default)
  • kCTUnderlineStyleSingle
  • kCTUnderlineStyleThick
  • kCTUnderlineStyleDouble

Modifier Values:

  • kCTUnderlinePatternSolid (default)
  • kCTUnderlinePatternDot
  • kCTUnderlinePatternDash
  • kCTUnderlinePatternDashDot
  • kCTUnderlinePatternDashDotDot

Definition at line 324 of file NIAttributedLabel.m.

- (void) setStrokeWidth: (CGFloat)  width
range: (NSRange)  range 

Modifies the stroke width for a given range.

A positive number will render only the stroke, whereas negivive a number are for stroke and fill. A width of 3.0 is a good starting point.

Definition at line 343 of file NIAttributedLabel.m.

- (void) setStrokeColor: (UIColor*)  color
range: (NSRange)  range 

Modifies the stroke color for a given range.

Normally you would use this in conjunction with setStrokeWidth:range: passing in the same range for both

Definition at line 363 of file NIAttributedLabel.m.

- (void) setTextKern: (CGFloat)  kern
range: (NSRange)  range 

Modifies the text kern for a given range.

The text kern indicates how many points the following character should be shifted from its default offset.

A positive kern indicates a shift farther away and a negative kern indicates a shift closer.

Definition at line 382 of file NIAttributedLabel.m.

Generated for Nimbus by doxygen 1.7.4-20110629