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, 01:07 PM   #1 (permalink)
ggalante
Registered Member
 
Join Date: Feb 2010
Posts: 11
Question Dynamically Change the TabBar at Runtime

Good afternoon everyone. Thanks in advance to anyone who can help with this. I am officially stumped. Here is my problem.

I have a set of 4 tabs with views working great. My app has a second mode, called gameplay mode. In this mode, I want to display 4 completely different tabs with 4 new views. I am trying to find a way to dynamically switch between the two sets of tabs and controllers. Right now I have the follow code:

Code:
[tbc setViewControllers:tc animated:YES];
[tbc setSelectedViewController:[tc objectAtIndex:0]];
tbc is a TabBarController
tc is an NSMutableArray of ViewControllers

However this code simply empties the tab bar, and gives me a blank screen.

I tried including
Code:
[window addSubview:tbc.view];
in there as well, but that was a bust.

I tried adjusting the tabbar items by hand by using
Code:
[[tbc tabBar] setItems:ti animated:YES];
where ti is an array of items. That threw an exception saying this action was not allowed.

Has anyone ever gotten this to work? Has anyone been able to dynamically add a tab and it's controller at runtime? Thanks again for any help given. This has been a surprisingly difficult problem.
ggalante is offline   Reply With Quote
 

» Advertisements
» Online Users: 278
18 members and 260 guests
ADY, apatsufas, BdR, ckgni, Duncan C, F_Bryant, glenn_sayers, Guthook, ilmman, joeallenpro, ketaskin, michelle, Music Man, NSeven, Sunny46, vogueestylee, zbynda, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,708
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

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