Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

UITabBar Item selectedItem

Posted on 2011-09-04
2
Medium Priority
?
1,642 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 2000 total points
ID: 36480537
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
ID: 36481694
yea... you're right lol. was thinking too hard.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface   In the first 100 days of the Macintosh release in January 1984, Apple sold 72,000 of the computers. Relatively cheap, easy-to-use personal computer with a graphical operating system. I've never seen this model. I did see this one:   …
I recently went through the process of creating an installable image of an iPhone mobile app (an .ipa file) that beta testers could load onto their test devices. The process involved quite a few steps, but both Appcelerator and Diawi.org had decent …
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.
Screencast - Getting to Know the Pipeline
Suggested Courses

963 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