Tab Bar Application Part 1
Step 1
Create a project
Step 2
Add Three new Classes
- FirstTabView
- SecondTabView
- ThirdTabView
Step 3
click the AppDelegate.h
add this code
//
// AppDelegate.h
// TabBarExample
//
// Created by Apple on
4/24/13.
// Copyright (c) 2013
Dhanushka Adrian. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@property (strong, nonatomic) UITabBarController *tabBarController; // add this code
@end
Step 4
click the AppDelegate.m
change the code of this method
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
//
// AppDelegate.m
// TabBarExample
//
// Created by Apple on
4/24/13.
// Copyright (c) 2013
Dhanushka Adrian. All rights reserved.
//
#import "AppDelegate.h"
#import "ViewController.h"
#import "FirstTabView.h"
#import "SecondTabView.h"
#import "ThirdTabView.h"
@implementation AppDelegate
- (void)dealloc
{
[_window release];
[_viewController release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override
point for customization after application launch.
FirstTabView *firstTab
=[[FirstTabView alloc]initWithNibName:@"FirstTabView" bundle:nil];
SecondTabView *secondTab
=[[SecondTabView alloc]initWithNibName:@"SecondTabView" bundle:nil];
ThirdTabView *thirdTab
=[[ThirdTabView alloc]initWithNibName:@"ThirdTabView" bundle:nil];
ViewController
*fourthTab =[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
UINavigationController *nav1 =[[UINavigationController alloc] initWithRootViewController:firstTab];
UINavigationController *nav2 =[[UINavigationController alloc] initWithRootViewController:secondTab];
UINavigationController *nav3 =[[UINavigationController alloc] initWithRootViewController:thirdTab];
UINavigationController *nav4 =[[UINavigationController alloc] initWithRootViewController:fourthTab];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nav4,
nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
[self.window addSubview:_tabBarController.view];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
}
- (void)applicationWillTerminate:(UIApplication *)application
{
}
@end
Step 5
".xib " files
FirstTabView.xib
SeondTabView.xib
ThirdTabView.xib
ViewController.xib
Step 6
Run the App
Good Luck!
Tutorial List
- SQLite Based iPhone Application
- json with IOS (Basic) - Tutorial
- Simple Table View in IOS
- Load Distinct Images from array into UITableView
- Simple UIPickerView Example
- Tab Bar Application Part 1
- Tab Bar Application Part 2
- Tab Bar Application Part 3 ( with Login Screen )
- Tab Bar Application Part 4 ( Navigation )
- Table View Design in IOS Part 1
- Table View Design in IOS Part 2 ( Time Table )
- How to Add search bar in Table View
- Local Notification in IOS
- Core Data (For Beginners )
- Core Data Tute 2 (Add/Delete/Search)
- Core Data Tute 3 (Two table)
- Custom Cell in UITableview
- Lazy Loading
- Pull to Refresh in TableView
- Working with keyboard in Objective C - Part 1
No comments:
Post a Comment