Up

NSAttributedString class reference

Authors

ANOQ of the sun (anoq@vip.cybercity.dk)
Richard Frith-Macdonald (richard@brainstorm.co.uk)

Version: 26606

Date: 2008-06-08 11:38:33 +0100 (Sun, 08 Jun 2008)

Copyright: (C) 1997,1999 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSAttributedString class
  2. Software documentation for the NSMutableAttributedString class
  3. Software documentation for the NSAttributedString(GSCategories) category

Software documentation for the NSAttributedString class

NSAttributedString : NSObject

Declared in:
Foundation/NSAttributedString.h
Conforms to:
NSCoding
NSCopying
NSMutableCopying
Availability: MacOS-X 10.0.0

A string in which name-value pairs represented by an NSDictionary may be associated to ranges of characters. Used for text rendering by the GUI/AppKit framework, in which fonts, sizes, etc. are stored under standard attributes in the dictionaries.
Method summary

attribute: atIndex: effectiveRange: 

- (id) attribute: (NSString*)attributeName atIndex: (unsigned int)index effectiveRange: (NSRange*)aRange;
Availability: MacOS-X 10.0.0

Returns value for given attribute at index, and, if effectiveRange is non-nil, this gets filled with a range over which this value holds. This may not be the maximum range, depending on the implementation.

attribute: atIndex: longestEffectiveRange: inRange: 

- (id) attribute: (NSString*)attributeName atIndex: (unsigned int)index longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit;
Availability: MacOS-X 10.0.0

Returns value for given attribute at index, and, if longestEffectiveRange is non-nil, this gets filled with the range over which the attribute applies, clipped to rangeLimit.

attributedSubstringFromRange: 

- (NSAttributedString*) attributedSubstringFromRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Returns substring with attribute information.

attributesAtIndex: effectiveRange: 

- (NSDictionary*) attributesAtIndex: (unsigned int)index effectiveRange: (NSRange*)aRange;
Availability: MacOS-X 10.0.0

Returns attributes and values at index, and, if effectiveRange is non-nil, this gets filled with a range over which these attributes and values still hold. This may not be the maximum range, depending on the implementation.

attributesAtIndex: longestEffectiveRange: inRange: 

- (NSDictionary*) attributesAtIndex: (unsigned int)index longestEffectiveRange: (NSRange*)aRange inRange: (NSRange)rangeLimit;
Availability: MacOS-X 10.0.0

Returns attributes and values at index, and, if longestEffectiveRange is non-nil, this gets filled with the range over which the attribute-value set is the same as at index, clipped to rangeLimit.

initWithAttributedString: 

- (id) initWithAttributedString: (NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0

Initialize to copy of attributedString.

initWithString: 

- (id) initWithString: (NSString*)aString;
Availability: MacOS-X 10.0.0

Initialize to aString with no attributes.

initWithString: attributes: 

- (id) initWithString: (NSString*)aString attributes: (NSDictionary*)attributes;
Availability: MacOS-X 10.0.0

Initialize to aString with given attributes applying over full range of string.

isEqualToAttributedString: 

- (BOOL) isEqualToAttributedString: (NSAttributedString*)otherString;
Availability: MacOS-X 10.0.0

Returns whether all characters and attributes are equal between this string and otherString.

length 

- (unsigned int) length;
Availability: MacOS-X 10.0.0

Return length of the underlying string.

string 

- (NSString*) string;
Availability: MacOS-X 10.0.0

Return the underlying string, stripped of attributes.

Software documentation for the NSMutableAttributedString class

NSMutableAttributedString : NSAttributedString

Declared in:
Foundation/NSAttributedString.h
Availability: MacOS-X 10.0.0

Mutable version of NSAttributedString .
Method summary

addAttribute: value: range: 

- (void) addAttribute: (NSString*)name value: (id)value range: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Adds attribute applying to given range.

addAttributes: range: 

- (void) addAttributes: (NSDictionary*)attributes range: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Add attributes to apply over given range.

appendAttributedString: 

- (void) appendAttributedString: (NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0

Appends attributed string to end of this one, preserving attributes.

beginEditing 

- (void) beginEditing;
Availability: MacOS-X 10.0.0

An empty method provided for subclasses to override.
Call before executing a collection of changes, for optimization.

deleteCharactersInRange: 

- (void) deleteCharactersInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Removes characters and attributes applying to them.

endEditing 

- (void) endEditing;
Availability: MacOS-X 10.0.0

An empty method provided for subclasses to override.
Call after executing a collection of changes, for optimization.

insertAttributedString: atIndex: 

- (void) insertAttributedString: (NSAttributedString*)attributedString atIndex: (unsigned int)index;
Availability: MacOS-X 10.0.0

Inserts attributed string within this one, preserving attributes.

mutableString 

- (NSMutableString*) mutableString;
Availability: MacOS-X 10.0.0

Returns mutable version of the underlying string.

removeAttribute: range: 

- (void) removeAttribute: (NSString*)name range: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Removes given attribute from aRange.

replaceCharactersInRange: withAttributedString: 

- (void) replaceCharactersInRange: (NSRange)aRange withAttributedString: (NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0

Replaces substring and attributes.

replaceCharactersInRange: withString: 

- (void) replaceCharactersInRange: (NSRange)aRange withString: (NSString*)aString;
Availability: MacOS-X 10.0.0

Subclasses should override this method.
Replaces substring; replacement is granted attributes equal to those of the first character of the portion replaced.

setAttributedString: 

- (void) setAttributedString: (NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0

Replaces entire contents (so this object can be reused).

setAttributes: range: 

- (void) setAttributes: (NSDictionary*)attributes range: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Sets attributes to apply over range, replacing any previous attributes.

Software documentation for the NSAttributedString(GSCategories) category

NSAttributedString(GSCategories)

Declared in:
Foundation/NSAttributedString.h
Availability: Not in OpenStep/MacOS-X

Description forthcoming.
Method summary

attributedSubstringWithRange: 

- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange;
Availability: Not in OpenStep/MacOS-X

Dep[recated synonym for attributedSubstringFromRange: for consistency with NSString


Up