-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions
{
Self. window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen] bounds];
Self. window. backgroundColor = [UIColor whiteColor];
// Generate various view Controllers
MedicalData * aa = [[MedicalData alloc] init];
HealthRecord * bb = [[HealthRecord alloc] init];
KonwledgeBase * cc = [[KonwledgeBase alloc] init];
Carepretries * dd = [[careprew.alloc] init];
// Add an array
NSArray * controllerArray = [[NSArray alloc] initWithObjects: aa, bb, cc, dd, nil];
// Create a UITabBarController controller (defined in. h. If arc is enabled, the controller is automatically released and memory access error occurs)
TabBarController = [[UITabBarController alloc] init];
// Set Delegation
TabBarController. delegate = self;
// Set the viewControllers attribute of the UITabBarController to the previously generated array controllerArray.
TabBarController. viewControllers = controllerArray;
// By default, 1st view tabs are selected (the index starts from 0)
TabBarController. selectedIndex = 0;
// Set the title and image of TabBarItem
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 0] setTitle: @ "aa"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 0] setImage: [UIImage imageNamed: @ "1517.png"]; // 30*30
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 1] setTitle: @ "bb"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 1] setImage: [UIImage imageNamed: @ "light.png"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 2] setTitle: @ "cc"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 2] setImage: [UIImage imageNamed: @ "podcaste.png"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 3] setTitle: @ "dd"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 3] setImage: [UIImage imageNamed: @ "setting.png"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 4] setTitle: @ "ee"];
[(UITabBarItem *) [tabBarController. tabBar. items objectAtIndex: 4] setImage: [UIImage imageNamed: @ "unlock.png"];
// Read
UIViewController * activeController = tabBarController. selectedViewController;
If (activeController = aa ){
//
}
// Add the view of tabBarController as a subview to the window
[Self. window addSubview: tabBarController. view];
[Self. window makeKeyAndVisible];
Return YES;
}
From fanwa Software