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

View Single Post
Old 02-07-2010, 09:22 PM   #2 (permalink)
ggalante
Registered Member
 
Join Date: Feb 2010
Posts: 11
Exclamation

SOLVED!

So here's the important stuff I was doing wrong. First make sure to alloc and init the array and views when you build your controllers. Here's how I built the array:
Code:
MyView1* vc1 = [[MyView1 alloc] init];
MyView2* vc2 = [[MyView2 alloc] init];
gpTabControllers = [[NSMutableArray alloc] init];
[gpTabControllers addObject:vc1];
[gpTabControllers addObject:vc2];
When you make the change to the new group of tabs, do this:
Code:
NSMutableArray *tc = gpTabControllers;
[tbc setViewControllers:tc animated:YES];
[window addSubview:tbc.view];
If you want to switch back, I would store the first group of controllers into another array. This might keep a lot of stuff in memory though.

Finally, you want to do the TabItems in the controllers themselves, which was where I was getting really confused. Overloading the init function in the MyView classes will do this. Here's a peak at what I added to those classes:
Code:
- (id)init {
	if (self = [super initWithNibName:@"MyView1" bundle:nil]) {
		self.title = @"Tab Item Title";
		
		UIImage* anImage = [UIImage imageNamed:@"tabItemImg.png"];
		UITabBarItem* theItem = [[UITabBarItem alloc] initWithTitle:@"Tab Item Title" image:anImage tag:0];
		self.tabBarItem = theItem;
		[theItem release];
	}
	return self;
}
I hope this helps someone else avoid a day long confusion spree like me. Thanks to everyone who was thinking about helping on this one, and thanks to everyone who helps on this site. It is always a big help for me.
ggalante is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,857
Threads: 89,223
Posts: 380,681
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Donovan472
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:20 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.