Solved

UITabBar Item selectedItem

Posted on 2011-09-04
2
1,599 Views
Last Modified: 2012-05-12
Hello EE,

In my Xcode application, I have a UITabBar with 2 items.

I know that if I have this:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item;
{
   NSLog(@"Test");
}

it will be called each time i touch an item. Even if its already selected.
I need to push a ViewController to the screen when touching item index 0.

but I dont want to call that viewController if its already selected... how can I skip that if already selected? I tried some code but didnt work well.
0
Comment
Question by:PhilippeRenaud
2 Comments
 
LVL 2

Accepted Solution

by:
Snapples earned 500 total points
Comment Utility
I don't really see the problem. Why not simply keep an integer of the current selected index??
If it's the same as the newly selected tabbar item index, do nothing, otherwise push in the viewController.
0
 
LVL 1

Author Closing Comment

by:PhilippeRenaud
Comment Utility
yea... you're right lol. was thinking too hard.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

What's a UDID? If you're involved in developing, testing, or even reviewing an iOS application that's in beta, then at some point you may need to know the UDID for any iOS devices that you'll be testing on. What's the UDID? It stands for Unique Dev…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now