iOS Developer Library — Prerelease

Developer

UIKit Framework Reference UIReferenceLibraryViewController Class Reference

Options
Deployment Target:

On This Page
Language:

UIReferenceLibraryViewController

A UIReferenceLibraryViewController object provides a dictionary service to look up the definition of a word or term from within an app. It should not be used to display wordlists, create a standalone dictionary app, or republish the content in any form.

You create and initialize a reference library view controller using the initWithTerm: method. You pass the term to define as the parameter to this method and the definition is displayed. You can present this view controller modally or as part of another interface. On iPad, you can set the reference library view controller as the content view controller of a UIPopoverController object. Optionally, use the dictionaryHasDefinitionForTerm: class method to check if a definition is available for a given term before creating an instance—for example, use this method if you want to change the user interface depending on whether a definition is available.

  • Returns whether a definition is available for the given term.

    Declaration

    Swift

    class func dictionaryHasDefinitionForTerm(_ term: String) -> Bool

    Objective-C

    + (BOOL)dictionaryHasDefinitionForTerm:(NSString * nonnull)term

    Parameters

    term

    The term to be defined.

    Return Value

    YEStrue if a definition for term is available; otherwise, NOfalse.

    Availability

    Available in iOS 5.0 and later.

  • init(term:) - initWithTerm: Designated Initializer

    Initializes a newly created reference-library view controller to display the definition of the given term.

    Declaration

    Swift

    init(term term: String)

    Objective-C

    - (instancetype nonnull)initWithTerm:(NSString * nonnull)term

    Parameters

    term

    The term to define.

    Return Value

    The newly initialized reference library view controller.

    Discussion

    If a definition for the term is not available, a localized message is displayed instead. Use the dictionaryHasDefinitionForTerm: class method to determine whether a definition is available before creating instances of this class.

    Availability

    Available in iOS 5.0 and later.