iPhone XCode - How to create a simple UITabBar
Tech-Today

iPhone XCode - How to create a simple UITabBar


A simple demonstration by code on how to implement a UITabBar on iPhone.

1.) Create a new Windows based project, and named it whatever you want.

2.) You should look up for 2 files, .h and .m (I named mine MyTab).

MyTabAppDelegate.h
#import <UIKit/UIKit.h>

@interface MyTabAppDelegate : NSObject {
UIWindow *window;
    UITabBarController *tabBarController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

MyTabAppDelegate.m
#import "MyTabAppDelegate.h"

@implementation MyTabAppDelegate

@synthesize window;


- (void)applicationDidFinishLaunching:(UIApplication *)application {
//initialize the UITabBarController
tabBarController = [[UITabBarController alloc] init];

//Create the first UITabBarItem
UIViewController *viewController1 = [[UIViewController alloc] init];
[viewController1 setTitle:@"MyTab1"];
//note that you can set the tab bar item's icon by uncommenting the line below
//viewController1.tabBarItem.image = [UIImage imageNamed:@"any image in your resource"];
viewController1.view.backgroundColor = [UIColor orangeColor];

//Create the second UITabBarItem
UIViewController *viewController2 = [[UIViewController alloc] init];
[viewController2 setTitle:@"MyTab2"];
viewController2.view.backgroundColor = [UIColor redColor];

//add the UIViewControllers to the UITabController
tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];

//release
[viewController1 release];
[viewController2 release];

//add to the main window
[window addSubview:tabBarController.view];
// Override point for customization after application launch
[window makeKeyAndVisible];
}

- (void)dealloc {
[window release];
[super dealloc];
}

@end




- Create An Iphone Application Using Xcode That Dynamically Creates Sqlite Tables
This tutorial will try to create an iphone application that will dynamically create tables in sqlite database. This tutorial will use anime information for example. Note that this tutorial is not for beginner, I'll just summarized the steps and provide...

- Uitabbarcontroller Error - Loaded The "yourview" Nib But The View Outlet Was Not Set
Working on a simple UITabBarController I encountered the above error "nib but the view outlet was not set". This usually happens when you create a new nib file and forgot to change the File's Owner class in the interface builder. So for example we...

- How To Make A Static Splash Screen In Iphone Using Xcode
By default an xcode project created for iPhone looks for Default.jpg image in the resources. So all you need to do is: 1.) Make sure that you have a "Default.jpg" image in your Resources project folder 2.) In the class file that extends UIApplicationDelegate,...

- Create An Image Slide Show In Iphone Using Xcode
Here's how you can create image slide show from xcode - iphone Requirement:  -3 png images. 1.) Create a new View-based application project. Name it AnimationDemo. 2.) Once the new project is created. Add the 3 png images to the Resources folder....

- Iphone Xcode - How To Implement A Uitableview
In this demo I will extend the class UITableViewController, so I already have access to UITableViewDelegate and UITableViewDataSource classes. Steps: 1.) Create a new window based project. Named it MyTable. 2.) I will explain the rest in codes: MyTableAppDelegate.h...



Tech-Today








.