Solved

UITabBar Item selectedItem

Posted on 2011-09-04
2
1,622 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
     Intro      In this article, I will show you how to parse a JSON in Swift using an open source library called SwiftyJSON (https://github.com/SwiftyJSON/SwiftyJSON). If you haven't heard of a JSON before, it stands for JavaScript Object Notation…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

634 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