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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 05-12-2010, 07:27 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: india
Posts: 65
sharhelia is on a distinguished road
Default calling viewdidload and viewwillappear methods

hi

i am making a simple tab bar based application.
i have taken the view based application and int the view controller class i have the following code to add three tabs

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	UINavigationController *localNavigationController;    
    NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];    
    tabBarController = [[UITabBarController alloc] initWithNibName:@"TabbedViewController" bundle:nil];
    tabBarController.delegate=self;
    
	FirstTabController *_firstTab = [[FirstTabController alloc] initWithNibName:@"FirstTabController" bundle:nil];
    localNavigationController = [[UINavigationController alloc] initWithRootViewController:_firstTab];
	localNavigationController.navigationBar.topItem.title = @"First View";
    localNavigationController.navigationBar.tintColor=[UIColor blackColor];
	
	//setting image and title for the first tab
	UITabBarItem *tabBarItem1 = [[UITabBarItem alloc] initWithTitle: @"SCHEDULE" image:[UIImage imageNamed: @"images0.png"] tag:0];
	localNavigationController.tabBarItem = tabBarItem1;
	[tabBarItem1 release];
	
	[localControllersArray addObject:localNavigationController];
	
	
	SecondTabController *_secondTab = [[SecondTabController alloc] initWithNibName:@"SecondTabController" bundle:nil];
    localNavigationController = [[UINavigationController alloc] initWithRootViewController:_secondTab];
	localNavigationController.navigationBar.topItem.title = @"Second View";
    localNavigationController.navigationBar.tintColor=[UIColor blackColor];
	
	//setting image and title for the second tab
	UITabBarItem *tabBarItem2 = [[UITabBarItem alloc] initWithTitle: @"UPCOMING" image:[UIImage imageNamed: @"images1.png"] tag:1];
	localNavigationController.tabBarItem = tabBarItem2;
	[tabBarItem2 release];
	
	
	[localControllersArray addObject:localNavigationController];
	
	ThirdTabController *_thirdTab = [[ThirdTabController alloc] initWithNibName:@"ThirdTabController" bundle:nil];
    localNavigationController = [[UINavigationController alloc] initWithRootViewController:_thirdTab];
	localNavigationController.navigationBar.topItem.title = @"Third View";
    localNavigationController.navigationBar.tintColor=[UIColor blackColor];
	
	//setting image and title for the third tab
	UITabBarItem *tabBarItem3 = [[UITabBarItem alloc] initWithTitle: @"RECENT" image:[UIImage imageNamed: @"images1.png"] tag:2];
	localNavigationController.tabBarItem = tabBarItem3;
	[tabBarItem3 release];
	
	
	[localControllersArray addObject:localNavigationController];
	
	
	tabBarController.viewControllers = localControllersArray;
	
	//self.navigationController.navigationBar.tintColor=[UIColor colorWithRed:0.0/255 green:113.0/255 blue:0.0/255 alpha:1.0];
	
	[localControllersArray release];
    
    self.view = tabBarController.view;
	tabBarController.delegate = self;


}


when i click on the tabs first time view did load is called but when i click on them after that that is for second or third time neither view did load nor view will appear is called.

i have to use table view in the third tab and i want to reload the data when i click on it that mean i want view will appear to be called somehow.

please let me know how to do this.


thanks
sharhelia is offline   Reply With Quote
Old 05-12-2010, 11:13 AM   #2 (permalink)
N3RD
 
Join Date: Oct 2009
Posts: 201
tychop is on a distinguished road
Default

Perhaps viewDidAppear ?
tychop is offline   Reply With Quote
Reply

Bookmarks

Tags
reload, second time, tabbar, viewdidload, viewwillappear

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: 315
15 members and 300 guests
Abidullah, baja_yu, cgokey, Duncan C, Fstuff, gbenna, guusleijsten, jbro, mdpauley, n00b, newDev, pkIDSF, Sami Gh, seokwon lee, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,113
Posts: 402,877
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

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