Developer

Intercepting Tile Creation Events

You can register delegates that are called by the Extensibility Framework before and after tile creation.

This lets you provide a custom tile, or modify the one that has been created by the framework. You have two options:
  • Make your app delegate a MAFTileCreatorDelegate; the framework checks whether the app delegate responds to the tile creator delegate APIs, and calls them if they are available.
  • Create a specific class that adheres to the MAFTileCreatorDelegate protocol, and implements its delegate methods. Make sure you register the delegate via the MAFCore –setTileCreatorDelegate API.
The MAFTileCreatorDelegate declares these APIs:
-(MAFTile*) willCreateTileWithId:(NSString*)tileID_in andContext:(MAFExtContext*)context_in;
-(void) didCreateTile:(MAFTile*)tile_in;
To go with the first option, add the MAFTileCreatorDelegate to the AppDelegate:
// AppDelegate.h
#import "MAFTileCreatorDelegate.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate, MAFTileCreatorDelegate>
To take over the task of creating the tile with ID LoginScreen, implement the willCreateTileWithId: API:
// AppDelegate.m
// skipping the usual AppDelegate code for brevity
#pragma mark - MAFTileCreatorDelegate Delegates
/**
 * The app delegate shall implement this method in the App Delegate in order to build custom tiles for specific identifiers.
 * @return nil if the client does not intend to create the tile for a given ID
 */
-(MAFTile*) willCreateTileWithId:(NSString*) tileID_in andContext:(MAFExtContext*) context_in
{
 	MAFTile* tile = nil;
   	if ([tileID_in isEqualToString:@"LoginScreen "]) 
{
        		// create the Tile and all it’s subviews programmatically
        		tile = [[[CustomLoginScreenMAFTile alloc] init] autorelease];
}
     	return tile;
   }
If you implement the MAFTileCreatorDelegate didCreateTile: API , the framework invokes this delegate method each time a tile is built. This allows you to add custom subviews or controls to a metadata-driven tile, or to modify the tile’s content. See Coded Subviews Embedded in Metadata-Driven Tiles.
/**
 * The app delegate shall implement this method in the App Delegate in order to decorate configuration based tiles for specific identifiers.
 */
-(void) didCreateTile:(MAFTile*)tile_in
{
// access and modify tile contents
 }