Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios tab bar button to modal view

Tags:

ios

I'm using idev-recipes/RaisedCenterTabBar and I want a modal view called from the center button, not a camera.

Code is here: https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar

Any ideas on how to get this working?

like image 961
stewart715 Avatar asked May 07 '12 00:05

stewart715


2 Answers

There is a better approach to follow in order to accomplish that. And much easier.

What I understand by implementing using this methodology: https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar is that strange things are happening when you are trying to hide the tab bar. So the best solution I found for me (the same thing as you do) is here: http://www.lantean.co/display-a-modal-uiviewcontroller-when-a-uitabbaritem-is-pressed/

There is no need to do anything else. Just ignore the view controller that the UITabBarItem is associated with and present your modal view! That's all!

like image 170
Tzegenos Avatar answered Nov 02 '22 05:11

Tzegenos


I would create your own subclass of UITabBarController and then add in this method:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item  {

}

You will be able to tell what item was selected and then instantiate a modal VC inside there.

like image 2
LJ Wilson Avatar answered Nov 02 '22 05:11

LJ Wilson