AVTextStyleRule Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 6.0 and later.
Declared in
AVTextStyleRule.h

Overview

An AVTextStyleRule object represents text styling rules that can be applied to text in a media item. You use text style objects to format subtitles, closed captions, and other text-related content of the item. The rules you specify can be applied to all or part of the text in the media item.

Tasks

Creating and Initializing Style Rules

Accessing the Style Attributes

Exporting the Style Rules

Properties

textMarkupAttributes

A dictionary of text style attributes to apply to the text. (read-only)

@property (nonatomic, readonly) NSDictionary *textMarkupAttributes;
Discussion

The supported keys for this dictionary are defined in CMTextMarkup.h.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

textSelector

A string that identifies the text to which the attributes should apply. (read-only)

@property (nonatomic, readonly) NSString *textSelector;
Discussion

The contents of the string are determined by the format of the legible media. For example, the string could contain the CSS selectors used by the corresponding text in Web Video Text Tracks (WebVTT) markup.

If the value of this property is nil, the text style attributes apply to all text in the media item.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

Class Methods

propertyListForTextStyleRules:

Converts one or more text style rules into a serializable property list object.

+ (id)propertyListForTextStyleRules:(NSArray *)textStyleRules
Parameters
textStyleRules

An array of AVTextStyleRule objects to write to the property list.

Return Value

A property-list object that you can pass to the NSPropertyListSerialization serialization routines.

Discussion

The property-list object returned by this method can be written to disk and stored persistently.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

textStyleRulesFromPropertyList:

Creates an array of text style rule objects from the specified property-list object.

+ (NSArray *)textStyleRulesFromPropertyList:(id)plist
Parameters
plist

A property-list object containing the text style data.

Return Value

An array of AVTextStyleRule objects corresponding to the style information in the property-list object.

Discussion

Use this method to create new text style rule objects based on data you previously converted to a property-list format using the propertyListForTextStyleRules: class method.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

textStyleRuleWithTextMarkupAttributes:

Creates and returns a new text style rule object using the style attributes in the specified dictionary.

+ (AVTextStyleRule *)textStyleRuleWithTextMarkupAttributes:(NSDictionary *)textMarkupAttributes
Parameters
textMarkupAttributes

A dictionary of style attributes. For a list of supported keys and values that you can include in this dictionary, see CMTextMarkup.h.

Return Value

A new text style rule object with the specified attributes.

Discussion

This method sets the textSelector property of the style object to nil, which causes the rules to be applied to all of the text in the media item.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

textStyleRuleWithTextMarkupAttributes:textSelector:

Creates and returns a new text style rule object using the specified style attributes and text range information.

+ (AVTextStyleRule *)textStyleRuleWithTextMarkupAttributes:(NSDictionary *)textMarkupAttributes textSelector:(NSString *)textSelector
Parameters
textMarkupAttributes

A dictionary of style attributes. For a list of supported keys and values that you can include in this dictionary, see CMTextMarkup.h.

textSelector

A string contains an identifier for the ranges of text to which the style attributes should be applied. Eligible identifiers are determined by the media format and its corresponding text content. For example, the string could contain the CSS selectors used by the corresponding text in Web Video Text Tracks (WebVTT) markup. Specify nil if you want the style attributes to apply to all text in the item.

Return Value

A new text style rule object with the specified attributes and range information.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

Instance Methods

initWithTextMarkupAttributes:

Initializes a text style rule object with the specified style attributes.

- (id)initWithTextMarkupAttributes:(NSDictionary *)textMarkupAttributes
Parameters
textMarkupAttributes

A dictionary of style attributes. For a list of supported keys and values that you can include in this dictionary, see CMTextMarkup.h.

Return Value

A text style rule object initialized with the specified attributes.

Discussion

This method sets the textSelector property of the style object to nil, which causes the rules to be applied to all of the text in the media item.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h

initWithTextMarkupAttributes:textSelector:

Initializes a text style rule object with the specified style attributes and text range information.

- (id)initWithTextMarkupAttributes:(NSDictionary *)textMarkupAttributes textSelector:(NSString *)textSelector
Parameters
textMarkupAttributes

A dictionary of style attributes. For a list of supported keys and values that you can include in this dictionary, see CMTextMarkup.h.

textSelector

A string contains an identifier for the ranges of text to which the style attributes should be applied. Eligible identifiers are determined by the media format and its corresponding text content. For example, the string could contain the CSS selectors used by the corresponding text in Web Video Text Tracks (WebVTT) markup. Specify nil if you want the style attributes to apply to all text in the item.

Return Value

A text style rule object initialized with the specified attributes and range information.

Availability
  • Available in iOS 6.0 and later.
Declared In
AVTextStyleRule.h