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.
- (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.
<!-- UIButton -->
<UIElement type="button">
...params skipped for brevity
<!-- assign events -->
<Event eventId="onClick">
<!-- ...and actions -->
<Action actionId="navigate">
<P pid="target" value="AppScreen" />
</Action>
</Event>
</UIElement>
// Notify framework to continue action processing [[NSNotificationCenter defaultCenter] postNotificationName:kMAFProcessFurtherActions object:nil];
// Notify framework to drop all remaining queued actions [[NSNotificationCenter defaultCenter] postNotificationName:kMAFDeleteFurtherActionsFromQueue object:nil];
-(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)
{
case MAFEXT_ACTION_TYPE_CUSTOM:
{
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;
}