iOS Developer Library

Developer

AVFoundation Framework Reference AVTextStyleRule Class Reference

Options
Deployment Target:

On This Page
Language:

AVTextStyleRule

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.

Inheritance


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 6.0 and later.
  • Creates an array of text style rule objects from the specified property-list object.

    Declaration

    Swift

    class func textStyleRulesFromPropertyList(_ plist: AnyObject!) -> [AnyObject]!

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Swift

    init!(textMarkupAttributes textMarkupAttributes: [NSObject : AnyObject]!)

    Objective-C

    - (instancetype)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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Swift

    init!(textMarkupAttributes textMarkupAttributes: [NSObject : AnyObject]!, textSelector textSelector: String!)

    Objective-C

    - (instancetype)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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Swift

    var textMarkupAttributes: [NSObject : AnyObject]! { get }

    Objective-C

    @property(nonatomic, readonly) NSDictionary *textMarkupAttributes

    Discussion

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

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Swift

    var textSelector: String! { get }

    Objective-C

    @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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

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

    Declaration

    Swift

    class func propertyListForTextStyleRules(_ textStyleRules: [AnyObject]!) -> AnyObject!

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.