Show TOC

Coded Subviews Embedded in Metadata-Driven TilesLocate this document in the navigation structure

You can add a manually coded view or control to a tile.

To add a manually coded view or control to a tile, implement the didCreateTile: delegate method in the AppDelegate (see Intercepting Tile Creation Events). This method is invoked by the framework when a tile is created. Since the tile is also passed as a parameter, you can freely modify it, by adding subviews (views and controls), reordering existing subviews, and so on.


This example adds a label to the PurchaseOrders tile:

-(void) didCreateTile:(MAFTile*)tile_in
   	if ([tile_in.identifier isEqualToString:@"PurchaseOrders"]) 
    	// add a button
UILabel* label = [[[UILabel alloc] initWithFrame: CGRectMake(200, 300, 200, 40)] autorelease];      
// add the element
 [tile_in.view addSubview:label]; 

For another way to add a coded subview to a metadata driven tile, see Creating Custom UI Elements.