Listening for Configuration-Based Control Events

You can set a delegate to intercept messages sent by the UI controls after a user interaction, for example, after tapping a button.

Implement the MAFTileActionHandlerDelegate protocol, and register the delegate via MAFTileCreatorDelegate’s registerActionHandlerDelegateForTile: API.

The MAFTileActionHandlerDelegate protocol exposes a single API that you must implement to listen for action handling:
- (BOOL) performAction:(MAFActionDescriptor*)actionDescriptor_in onTile:(MAFTile*)tile_in sender:(UIView*)sourceUIElement_in context:(MAFContext*)context_in waitUntilDone:(BOOL*)waitUntilDoneFlag_in;

You can specify in the return value to either process the given action or let the framework handle it. Return YES to take over processing of a particular action; otherwise, return NO. To execute both your own logic and the framework’s, perform your custom logic and return NO.

The actionDescriptor_in parameter holds information about the action that has been fired by the view or control. This configuration describes a button that fires a “navigate” action after the device user taps the button:
      <!-- UIButton -->
      <UIElement type="button">
        ...params skipped for brevity
        <!-- assign events -->
        <Event eventId="onClick">
          <!-- ...and actions -->
          <Action actionId="navigate">
            <P pid="target" value="AppScreen" />
tile_in holds the view or control (a UIButton in this example) that receives the event (onClick) and fires the action (navigate). The waitUntilDoneFlag_in parameter is passed as a BOOL pointer, so that the delegate implementation can set its value (default: NO). If you set this flag to YES (*waitUntilDoneFlag_in = YES;), the framework pauses further action processing. To restart action processing, send a kMAFProcessFurtherActions:
// Notify framework to continue action processing
[[NSNotificationCenter defaultCenter] postNotificationName:kMAFProcessFurtherActions object:nil];
You can also send a kMAFDeleteFurtherActionsFromQueue notification to drop all further queued actions:
// Notify framework to drop all remaining queued actions 
 [[NSNotificationCenter defaultCenter] postNotificationName:kMAFDeleteFurtherActionsFromQueue object:nil];
To handle a custom action (MyCustomActionID) in a custom tile controller, use:
-(BOOL) performAction:(MAFActionDescriptor*)actionDescriptor_in onTile:(MAFTile*)tile_in sender:(UIView*)sourceUIElement_in context:(MAFContext*)context_in waitUntilDone:(BOOL*)waitUntilDoneFlag_in
    BOOL retVal = NO;   
    switch (actionDescriptor.actionType) 
            if ([actionDescriptor.customActionID isEqualToString:@"MyCustomActionID"]) 
                //perform custom action
// set return value to YES, indicating that we handled the event, and the framework should not try to process it
	retVal = YES;
        } break;
    return retVal;