Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-03-2009, 01:34 AM   #1 (permalink)
iOS Dev
 
Join Date: Aug 2009
Location: Chandigarh
Posts: 39
Send a message via Skype™ to Jango
Question UITabBar Programatically

Hi,
I have a slight issue thats been bugging me today.

I have this tabBar that i declared. Everything is fine but the navigation bar when it appears, its coming on half the screen.. I want it like the normal navigation bar on top where it should be.


Here's the code.

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
//create the main view
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor darkGrayColor];
self.view = contentView;
[contentView release];

//add the Navigation Controller and add the FirstView as the Root View
UINavigationController *localNavigationController;

NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:4];

//add the tab-bar
UITabBarController *tabBarController;
tabBarController = [[UITabBarController alloc]init];

// define a custom frame size for the entire tab bar controller that will be in the
// bottom half of the screen.
CGRect tabBarFrame;
tabBarFrame = CGRectMake(0, 240, 320, 200);
tabBarController.view.frame = tabBarFrame;

//set-up the First View Controller
SmartDialer *firstView;
firstView = [[SmartDialer alloc] initWithTabBar];

localNavigationController = [[UINavigationController alloc] initWithRootViewController:firstView];

// add the new nav controller (with the root view controller inside it)
// to the array of controllers
[localControllersArray addObject:localNavigationController];

// release since we are done with this for now
[localNavigationController release];
[firstView release];

// set-up the SecondView Controller
IDCalls *secondView;
secondView = [[IDCalls alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:secondView];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[secondView release];

// set-up the ThirdView Controller
Reverselookup *thirdView;
thirdView = [[Reverselookup alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:thirdView];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[thirdView release];

// set-up the FourthView Controller
UpcomingBdays *fourthView;
fourthView = [[UpcomingBdays alloc] initWithTabBar];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:fourthView];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[fourthView release];

// load up our tab bar controller with the view controllers
tabBarController.viewControllers = localControllersArray;
[localControllersArray release];

[self.view addSubview:tabBarController.view];


}

Please suggest...
Jango is offline   Reply With Quote
Reply

Bookmarks

Tags
navbar, tabbar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 266
14 members and 252 guests
2WeeksToGo, AdamL, ADY, BrianSlick, Dani77, Dattee, headkaze, mer10, prchn4christ, smithdale87, timle8n1, Touchmint, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,879
Threads: 89,228
Posts: 380,747
Top Poster: BrianSlick (7,129)
Welcome to our newest member, mgon987
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0