I would like to create a menu with a tab that the user can pull down to display the menu. In some cases the menu would open automagically if there is data that is urgent. In other cases the menu would be closed with just the tab visible where the user could touch/pull the tab to display the menu.
I’m not clear on how to do the following:
- Display the tab (similar to a Google Chrome tab).
- Hide the menu and only display the tab.
- Provide the slide out animation to display the view/viewcontroller
that the tab is connected to.
Implicit in your line of questioning is the assumption that there’s some built-in control in iOS that has menus that appear and disappear. There isn’t. I’m sure there is third party code that does this for you (google it if you want), but most of us just do it ourselves, since it isn’t that hard. So, in answer to your questions:
To display a tab, just make an image that you want your tab to look like and just add it to your view. There’s nothing fancy about it. Either add it in Interface Builder, or programmatically put it on the view.
Then just only show the tab, don’t even add the menu to the view yet.
To have a menu appear, there are a couple of ways of doing it. One model would be to (a) create what I’d call a clipping view (just a simple UIView the exact size and location of your final pulled down menu and make sure this view has clipping turned on); (b) put the menu view (a view with all of the graphical elements and controls of which your final menu will consist) on the clipping view, but just offscreen above it (e.g. add it with a frame of (0,-height,width,height)); and then (c) animate the menu into place (e.g. with a frame of (0,0,width,height)).
If any of this doesn’t make sense, then I’d suggest you take this one step at a time, perhaps getting some good training materials on how to do this sort of stuff before you proceed. If you’re not familiar with programmatically adding controls, then focus on that before you get into animation. Also carefully review the View Programming Guide. Just figure out how to have some IBAction have the menu appear on screen. No point in proceeding to the slick animation until know how to get the stuff to be animated to appear. Once you’ve mastered that, proceed to animation. If you’re not familiar with animation, read the following chapter on Animation.