UAInAppMessageControllerDelegate

@protocol UAInAppMessageControllerDelegate <NSObject>

Delegate protocol for providing custom UI to the UAInAppMessageController.

  • Returns a view configured with data from the provided message. Use this method to configure your custom view with colors, alert text, etc.

    Declaration

    Objective-C

    - (nonnull UIView *)viewForMessage:(nonnull UAInAppMessage *)message
                            parentView:(nonnull UIView *)parentView;

    Swift

    func view(for message: UAInAppMessage, parentView: Any!) -> Any!

    Parameters

    message

    The associated in-app message.

    parentView

    The parent view the messageView will be embedded in

    Return Value

    A configured instance of UIView.

  • Returns the button corresponding to the indexed action associated with the message. This button will be automatically configured for touch events in the controller.

    Declaration

    Objective-C

    - (nonnull UIControl *)messageView:(nonnull UIView *)messageView
                         buttonAtIndex:(NSUInteger)index;

    Swift

    func messageView(_ messageView: Any!, buttonAt index: UInt) -> Any!

    Parameters

    messageView

    The custom message view.

    index

    The index of the action.

    Return Value

    An instance of UIControl.

  • Indicates that the message view has changed touch state, meaning that the message view has been tapped and touch is either down or up. Use this event to update the view accordingly, such as by inverting colors.

    Declaration

    Objective-C

    - (void)messageView:(nonnull UIView *)messageView
        didChangeTouchState:(BOOL)touchDown;

    Swift

    optional func messageView(_ messageView: Any!, didChangeTouchState touchDown: Bool)

    Parameters

    messageView

    The message view.

    touchDown

    YES if the event represents a touch down, NO if it represents a touch up.

  • Display animation hook. Use this event to perform custom animation for the message view. At the time this method is called, the message view will already be added as a sub view of the parent, with no positioning other than that dictated by its geometry or layout cronstraints. It is the delegate’s responsibility to ensure that it animates to its final display position, which would typically be a transition from offscreen coordinates to its proper display coordinates.

    Declaration

    Objective-C

    - (void)messageView:(nonnull UIView *)messageView
        animateInWithParentView:(nonnull UIView *)parentView
              completionHandler:(nonnull void (^)(void))completionHandler;

    Swift

    optional func messageView(_ messageView: Any!, animateInWithParentView parentView: Any!, completionHandler: @escaping () -> Void)

    Parameters

    messageView

    The associated message view.

    parentView

    The parent view the message view has been added to.

    completionHandler

    A completion handler to call once the animation is complete.

  • Dismiss animation hook. Use this event to perform custom animation for the message view. It is the delegate’s responsibility to ensure that it animates to its final dismissal position, which would typically be offscreen coordinates.

    Declaration

    Objective-C

    - (void)messageView:(nonnull UIView *)messageView
        animateOutWithParentView:(nonnull UIView *)parentView
               completionHandler:(nonnull void (^)(void))completionHandler;

    Swift

    optional func messageView(_ messageView: Any!, animateOutWithParentView parentView: Any!, completionHandler: @escaping () -> Void)

    Parameters

    messageView

    The associated message view.

    parentView

    The parent view the message view has been added to.

    completionHandler

    A completion handler to call once the animation is complete.