I am trying to implement a hideable UITabBar in my app. I've set up all the animations, and they work very well. I'm just having an issue getting my UIButton "pull-tab" to show the tab bar. It is not responding to the touch event UIControlEventTouchUpInside. I add the pull-tab to the UITabBar in the UITabBarController:
- (void)viewDidLoad
{
[super viewDidLoad];
//Add pull
pullButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *image = [UIImage imageNamed:@"TabBarPull.png"];
pullButton.frame = CGRectMake(self.tabBar.frame.size.width - image.size.width, -image.size.height + 3, image.size.width, image.size.height);
[pullButton setImage:image forState:UIControlStateNormal];
[pullButton addTarget:self action:@selector(pullBarTapped:) forControlEvents:UIControlEventTouchUpInside];
pullButton.userInteractionEnabled = YES;
[self.tabBar addSubview:pullButton];
}
Here is what the tab bar looks like open and closed:
Edit: I've determined that the problem is because the button falls outside the UITabBar's frame. Looks like I'm going to have to put the button outside of the UITabBar... Animation nightmare.
You can still add the UIButton
to the UITabBarController
's main view, not in the UITabBar
though.... [myUITabBarController.view addSubview:pullButton]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With