Up
Authors
- ANOQ of the sun (
anoq@vip.cybercity.dk
)
-
- Richard Frith-Macdonald (
richard@brainstorm.co.uk
)
-
Version: 37003
Date: 2013-08-22 09:44:54 -0600 (Thu, 22 Aug 2013)
Copyright: (C) 1997,1999 Free Software Foundation, Inc.
- 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
- (id)
attribute: (
NSString*)attributeName
atIndex: (
NSUInteger)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.
- (id)
attribute: (
NSString*)attributeName
atIndex: (
NSUInteger)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.
- (
NSAttributedString*)
attributedSubstringFromRange: (
NSRange)aRange;
Availability: MacOS-X 10.0.0
Returns substring with attribute information.
- (
NSDictionary*)
attributesAtIndex: (
NSUInteger)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.
- (
NSDictionary*)
attributesAtIndex: (
NSUInteger)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.
- (id)
initWithAttributedString: (
NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0
Initialize to copy of
attributedString.
- (id)
initWithString: (
NSString*)aString;
Availability: MacOS-X 10.0.0
Initialize to aString with no
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.
- (BOOL)
isEqualToAttributedString: (
NSAttributedString*)otherString;
Availability: MacOS-X 10.0.0
Returns whether all characters and attributes are
equal between this string and otherString.
- (
NSUInteger)
length;
Availability: MacOS-X 10.0.0
Return length of the underlying string.
- (
NSString*)
string;
Availability: MacOS-X 10.0.0
Returns the string content of the receiver.
NB. this is actually a proxy to the internal content
(which may change) so if you need an immutable
instance yu should copy the returned value, not
jhust retain it.
Return the underlying string,
stripped of attributes.
- Declared in:
- Foundation/NSAttributedString.h
Availability: MacOS-X 10.0.0
Method summary
- (void)
addAttribute: (
NSString*)name
value: (id)value
range: (
NSRange)aRange;
Availability: MacOS-X 10.0.0
Adds attribute applying to given range.
- (void)
addAttributes: (
NSDictionary*)attributes
range: (
NSRange)aRange;
Availability: MacOS-X 10.0.0
Add attributes to apply over given range.
- (void)
appendAttributedString: (
NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0
Appends attributed string to end of this one,
preserving attributes.
- (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.
- (void)
deleteCharactersInRange: (
NSRange)aRange;
Availability: MacOS-X 10.0.0
Removes characters and attributes applying to them.
- (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.
- (void)
insertAttributedString: (
NSAttributedString*)attributedString
atIndex: (
NSUInteger)index;
Availability: MacOS-X 10.0.0
Inserts attributed string within this one,
preserving attributes.
- (
NSMutableString*)
mutableString;
Availability: MacOS-X 10.0.0
Returns mutable version of the underlying string.
- (void)
removeAttribute: (
NSString*)name
range: (
NSRange)aRange;
Availability: MacOS-X 10.0.0
Removes given attribute from aRange.
- (void)
replaceCharactersInRange: (
NSRange)aRange
withAttributedString: (
NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0
Replaces substring and attributes.
- (void)
replaceCharactersInRange: (
NSRange)aRange
withString: (
NSString*)aString;
Availability: MacOS-X 10.0.0
Subclasses
must override this method.
Replaces substring; replacement is granted
attributes equal to those of the first character
of the portion replaced.
- (void)
setAttributedString: (
NSAttributedString*)attributedString;
Availability: MacOS-X 10.0.0
Replaces entire contents (so this object can be
reused).
- (void)
setAttributes: (
NSDictionary*)attributes
range: (
NSRange)aRange;
Availability: MacOS-X 10.0.0
Sets attributes to apply over range,
replacing any previous attributes.
Up