Because the controls are implemented as table view cells, the most convenient way to present them is to use a table view, or table view controller and provide the locale-aware controls as cells using the table view datasource protocol.
To try out the MAF locale-aware controls, create a simple view controller that implements the UITableViewDelegate and UITableViewDataSource protocols and present a single table view UI element on it. Create a tableView object, then add it to the view controller’s view and set the class itself (=’self’) as the data source and delegate for the tableView. You can later use the data source delegate to populate the table view with MAF locale- aware controls. This code shows the basic non-MAF-specific application frame (with .h/.m files) for your sample:
#import <UIKit/UIKit.h> @interface MySampleViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>{} @end
#import "MySampleViewController.h" @interface MySampleViewController () // the table view, in which we show the different types of MAF locale aware controls, per sections @property (nonatomic, retain) UITableView* tableView; // a 'static' array for holding the MAF locale aware controls, namely the MAF table view cells @property (nonatomic, retain) NSMutableArray* tableViewCells; @end @implementation MySampleViewController @synthesize tableView; - (id) init { if (self=[super init]) { UITableView* tempTableView = [[UITableView alloc] initWithFrame: CGRectMake(0, 0, 320, 640) style:UITableViewStyleGrouped]; // set table view's size according to the idiom iphone self.tableView = tempTableView; [tempTableView release]; self.tableView.delegate = self; // set the table view delegates object self.tableView.dataSource = self; // we provide the stored table view cells (which contain the MAF Locale Aware Controls sections) [self.view addSubview:self.tableView]; // add the table view to the view controller's view // create storage for storing the fixed and small number of table view cells' sections / MAFTableViewCells, i.e. the locale aware controls NSMutableArray* tempTableCells = [[NSMutableArray alloc] init]; self.tableViewCells = tempTableCells; [tempTableCells release]; // create the locale aware controls [self createLocaleAwareControls]; } } // … @end