A layout that provides a custom, interactive view inside the transcript.
- iOS 11.0+
Use a live layout instance to create custom, interactive messages in the transcript (or input field). An alternative layout is required to represent your message on devices that don’t have your iMessage app installed, or on devices that aren’t running iOS 11 or later. Note: this could be either the receiver’s or the sender’s device; the sender may have a second device that doesn’t have your app installed.
Set the alternative layout when you instantiate your
MSMessage object. Use an
MSMessage instance. The template layout automatically provides support for devices that do not support iMessage apps (macOS, iOS 9 and earlier, and SMS devices). See Listing 1 for an example.
MSMessage object with a live layout is added to the transcript (or input field), the system instantiates a new instance of your
MSMessages subclass, with its
presentation property set to the
The view controller’s
selected property is set to the interactive message just before the controller’s
will method is called. Use the
selected property to access the message and display its contents.
The Messages app renders your controller’s view inside a bubble in the transcript. Your controller must check its presentation style and display an appropriate user interface for the message. You can define the message’s size by overriding your view controller’s
There can be multiple live messages (from multiple iMessage apps) in the transcript at the same time. This means your app may have multiple instances of its
MSMessages subclass running concurrently:
One instance for each message in the transcript
One instance for a message in the input field (when you stage the message by calling
One instance for the app’s main interface if your iMessage app is currently active