In the Instagram app, when you click the middle button in the bottom Tab Bar, it pops open a view controller (seems modally) and this view controller covers the whole screen including the tab bar and nav bar. How can I achieve this? I began creating a seperate view controller and subclassed the tab bar controller so when the middle item was clicked, I ran a custom segue. This works well, but what is wrong is when I dismiss the modal, the view controller already attached to the middle tab bar item is showing. What should happen is when the middle tab bar item is tapped, simply the modal popup occurs and that's all. How can I stop the middle tab bar item from showing it's view controller and just running the custom modal segue?
1
votes
1 Answers
0
votes
Seems like you are using tab-bar navigation in your app, why dont you just add an empty bar and attach a button with an action manually?
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height);
[button setBackgroundImage:buttonImage forState:UIControlStateNormal];
[button setBackgroundImage:highlightImage forState:UIControlStateHighlighted];
CGFloat heightDifference = buttonImage.size.height - self.tabBar.frame.size.height;
if (heightDifference < 0)
button.center = self.tabBar.center;
else
{
CGPoint center = self.tabBar.center;
center.y = center.y - heightDifference/2.0;
button.center = center;
}
[self.view addSubview:button];