Class

MSStickerBrowserViewController

Use the MSStickerBrowserViewController to present the standard sticker browser. This browser provides drag-and-drop functionality. The user can press and hold a sticker to peel it from the browser, then drag the sticker to any balloon in the transcript. The user can also tap stickers to add them to the Messages app’s input field.

Overview

The browser presents the stickers provided by its MSStickerBrowserViewController property. The data source can dynamically change the list of stickers at runtime. You can also customize the size of the stickers inside the browser.

Setting the Sticker Browser as Your Root View

To use the sticker browser view controller as your extension’s root view, perform the following steps:

  1. Create a custom subclass of the MSStickerBrowserViewController class. For more information, see the subclassing notes.

  2. In Interface Builder, add a container view to your extension’s initial scene and pin it to fill the root view as desired. For more information on setting up a container view, see Configuring a Container in Interface Builder.

  3. In the Identity inspector, set the embedded view controller’s class to your custom MSStickerBrowserViewController subclass.

By using an MSMessagesAppViewController instance as the extension’s root view controller, this approach ensures that the root view controller can respond to important messages from the system, while the contained sticker browser view controller focuses on managing your stickers.

Subclassing Notes

By default, this controller sets itself as its sticker browser view’s data source. You must either provide another data source, or implement both numberOfStickersInStickerBrowserView: and stickerBrowserView:stickerAtIndex:.

For more information, see MSStickerBrowserViewDataSource.

Symbols

Working with Stickers

- initWithStickerSize:

Creates a new sticker browser view controller with stickers of the provided size.

stickerBrowserView

The sticker browser view managed by this controller.

stickerSize

A constant that indicates the size of the stickers.

Relationships

Inherits From