I Want to call my own method, i.e. myMethod()
when same tab bar is selected which is already selected.
I had tried to call didSelectMethod()
but it is not called in my ViewController class.
Please help me in this,
Thank you
Jagveer Rana
Asked
Active
Viewed 98 times
1

Rajesh
- 10,318
- 16
- 44
- 64

Jagveer Singh
- 2,258
- 19
- 34
2 Answers
1
It sounds like your ViewController class is not the delegate for your UITabBarController, otherwise tabBarController:didSelectViewController:
would be called.
Make sure your delegate is linked up properly.
If that's not the problem, then there are a few other StackOverflow questions asking the same thing:
Tab bar, reload every time tab is pressed
Detect a re-tab on selected UITabbarItem
-
thanx alot brother. can u accept my question plaese – Jagveer Singh Sep 24 '14 at 05:57
-
That's not how it works @JagveerSingh - not possible to "accept" a question. You can upvote my answer if it helped you at all though. – siburb Sep 25 '14 at 00:05
1
Where you own your tabBarController
instance there you set delegate
tabBarController.delegate= self; // It is must to set delegate
add the below delegate method
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if ([viewController respondsToSelector:@selector(myMethod)]) {
[viewController performSelector:@selector(myMethod)];
}
}

Rajesh
- 10,318
- 16
- 44
- 64