Creating Custom UI Elements

To intercept UI element creation notifications, use MAFUIElementCreatorDelegate, which lets you create custom subviews or decorate the ones created by the framework.

MAFUIElementCreatorDelegate declares these APIs:

Example 1

This example demonstrates how to create a UILabel with the ID “CustomLabel” in the configuration and return to the Extensibility Framework, which adds the label as a subview to the tile:
- (UIView*) willCreateUIElementWithId:(NSString*)uiElementId_in listItemIndex:(NSNumber*)listItemIndex_in tileDescriptor:(MAFTileDescriptorBase*)tileDescriptor_in context:(MAFContext*)context_in
{  
    UIView* result = nil;
    if ([uiElementId_in isEqualToString:@"CustomLabel "])
   {
        UILabel* label = [[[UILabel alloc] init] autorelease];
        label.text = @"This is a custom Label";
        label.textColor = [UIColor redColor];
        label.backgroundColor = [UIColor yellowColor];
        result = label;
    }
    return result;
}