I am just about to start a new project where I have a custom menu that I need to display on everyview that I have. I dont want to use tab bars as this menu is custom designed and may have some animation added to it at some point.
Is there a simple way of creating this menu in one place so that I dont have to build it into every xib file??
Thanks
The tab bar controller is a system provided container controller. If you’re using iOS 5 and later, you can make your own custom container view controller:
See Custom Container View Controllers discussion in the View Controller Programming Guide.
The key methods you need are enumerated in the UIViewController Class Reference, too.
I’d also suggest checking out WWDC 2011 #102 – Implementing UIViewController Containment.
Update:
If you want to write your own custom menu, you could do something like the following. I’m not doing anything fancy, but I’m just adding three colored subviews that might correspond to your custom buttons. And I have a tap gesture recognizer on each, which you can obviously handle as you see fit:
Then, you various view controllers just need to make sure to add the
CustomMenuto the view:I confess that I’ve given up on iOS 4.3 support (it just isn’t worth the heartache and the size of the 4.3 audience is pretty small nowadays), so I don’t deal with this silliness any more, but hopefully this gives you a sense of what one possible solution might look like.