简体   繁体   中英

How to create a dropdown menu from navigationbar (iOS)

I am trying to create a dropdown menu from the navigation bar. Something like this:

http://pttrns.com/320x480/screens/popovers/Readability_News-01.PNG.image

Readability is just one of the apps that does something like this.

How can i make something similar? Is that an uitableview?

This should let you do the popover in an iphone. http://www.cocoacontrols.com/platforms/ios/controls/wepopover

its not exactly like that of readability, but I guess you could mess with it to make it look closer to what you want it to look like.

Yes, you can do this too! This is more in line with a OSX sheet. What you would do is as follows:

  • create an overlay view - a clear UIView with userInteraction turned off - to prevent user from tapping elsewhere in your app (or you can use a tap in this view to dismiss the sheet. Add this view as a subview to your view or the view.window.

  • create the "sheet" using another view. In the example above, it would appear to be a table view, but you can do any kind of view you want. You can set the frame of this view to have a 0 height, add it to the view (or window). then animate using a new frame with the real height to get the "sheet" to "drop down" from the top of the screen.

  • This newly added view is then managed by your primary view class.

  • When you want to dismiss it, you then animate the frame back to have a height of 0, remove that view from its superview, remove the overlay view from its superview, and your done!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM