In my app I have a tab bar at the bottom with 4 tab bar items, and what I want to do is run a method when a given tab bar item is pressed.
How can I do this?
The purpose of the methods is to send a javascript string/command to the same webview.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is pretty straightforward: just use the
UITabBarDelegatewhich lets you get callbacks whenever a tab bar item is selected.See the Apple reference here:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITabBarDelegate_Protocol/Reference/Reference.html
…and you want to look in particular at the
tabBar:didSelectItem:method.