Solved

UITabBar Item selectedItem

Posted on 2011-09-04
2
1,613 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
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
USB Key with Secure software for Windows and IOS IMac 11 114
iPad Testing Issue 4 63
Push wifi profile to Android & IOS 1 35
Identity Management & Mobile Apps 5 55
In this article I'm going to cover the basics and usages of NSInvocation. What is NSInvocation? Apple Developer Reference describes NSInvocation this way: An NSInvocation is an Objective-C message rendered static, that is, it is an action tur…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 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