I want to hide an image when the tabBar button is pressed.I have
self.tabBarController.delegate = self;
in my app delegate and the code below is located in my view controller's .m file . but it doesn't work . Can anyone help pls ?
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
if (viewController.tabBarC开发者_StackOverflow社区ontroller == nil)
{
img.hidden = YES;
NSLog(@"Tab Bar Button");
}
}
Do you know that
In versions of iOS prior to version 3.0, this method is called only when the selected view controller actually changes. In other words, it is not called when the same view controller is selected.
In addition to this, make sure you are hiding the imageView
that contains the image.
UPDATE
Get the tabBarController
instance in the view controller and make its delegate the view controller. Then you can call this method in the view controller.
give name for the tabbarcontroller and then set the delegate for that.If my suggestion not useful,then ask me freely
精彩评论