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 02-01-2009, 12:43 PM   #1 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 11
Default How can I simulate a TabBarItem click?

I have a Tab Controller with 4 tabs. I'm deep in one of my tabs (lets say tab number 1) and I want to jump to tab number 3 just as if I would have clicked the tab item. Does anyone know how to do this?
fontecir is offline   Reply With Quote
Old 02-01-2009, 02:44 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default

Isn't that the tab bar's selectedView property? just set that to 2, I am pretty sure it is zero based, so 2 should give you view three.

Mark
bytor99999 is offline   Reply With Quote
Old 02-01-2009, 03:23 PM   #3 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

Close. If using a UITabBarController then set the 'selectedIndex' property.
RickMaddy is offline   Reply With Quote
Old 02-01-2009, 09:05 PM   #4 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 11
Default Close to the solution

Thanks for the solution. You were right, I tried

self. tabBarController.selectedIndex = 3 and it worked.

Now, the follow on question, I have a view and a textfield in that view and I need to update the textfield. How can I access that view?
fontecir is offline   Reply With Quote
Old 03-20-2009, 05:56 AM   #5 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 2
Default Can u help me out?

Quote:
Originally Posted by fontecir View Post
Thanks for the solution. You were right, I tried

self. tabBarController.selectedIndex = 3 and it worked.

Now, the follow on question, I have a view and a textfield in that view and I need to update the textfield. How can I access that view?
------
Hi. I'm a newBie to iPhone development
When a tabBarItem is clicked i change my view but the tabBar focus remain on same item..Also when i click the same tabBarItem I want to load the view corresponding view.

how can i achieve this????
Any help appreciated....
If possible let me know the code.
sumitmorey is offline   Reply With Quote
Old 03-27-2009, 05:40 PM   #6 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 2
Default

Hi. I'm working on a similar issue / problem for my app. Perhaps we can help eachother out.

I have 4 tabs, 1 of which is for Account settings. The app requires an account on a webservice for certain actions, but not everything... I want to force the user over to the Account tab when they try to go to a tab that requires an account and they haven't set one up or the account couldn't be validated.

I'm testing by just setting a BOOL logged_in = NO and if (!logged_in) { self.tabBarController.selectedIndex = 3; } in tab 2's viewController since this one with require an account.. The first time I click on tab 2, it switches tabs, but when i click on it again, I can see the tab has loaded...

Any ideas?

Thanks!

Jeff
Top_Shelf is offline   Reply With Quote
Old 03-28-2009, 05:08 AM   #7 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Atlanta
Posts: 411
Default

Quote:
Originally Posted by fontecir View Post
Thanks for the solution. You were right, I tried

self. tabBarController.selectedIndex = 3 and it worked.
Also note:

Quote:
[tabBar setSelectedIndex:3];
will work if you have an IBOutlet linking to the tabbarcontroller.
funkytaco is offline   Reply With Quote
Reply

Bookmarks

Tags
tabbar, tabbatitem

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: 245
17 members and 228 guests
ADY, Alsahir, Dani77, Desert Diva, Duncan C, F_Bryant, Grinarn, HemiMG, Herbie, jansan, linkmx, M@realobjects, macquitzon216, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,761
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

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