It appears that side-swipe menus are becoming a more common interface element as more information gets crammed into each iPhone app. Facebook has included it in their latest version and the new Gmail app appears to include it as well. I was wondering if anybody had thoughts on the most efficient way of developing something like this as it's becoming a more common interface element. While I have my own thoughts on how to build this, I'm curious to hear what other people think.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
There are tens of different libraries that developers have created to implement the Facebook/Path style navigation for iOS apps. I can list all of them but as you have asked for the best one, here are my two choices that i use to implement the side swipe navigation menu:
1) ECSlidingViewController Its very easy to implement and use Storyboards also. I haven't had any issues implementing it nor received any errors or anything like that. The link i provided has pretty much all the explanation in order to use it.
2) SWRevealViewController This library is easy to use and you can find a tutorial HERE, that shows how to implement it with all the explanation along with images. You can just follow the tutorial and thank me later.
Facebook's implementation places a UIPanGestureRecognizer on the UINavigationBar. Thus allowing to catch swipes where it's needed.
That allows to do things like, recognizing the touch direction in x/z directly as well as the speed they occurred with.
Also such kind of tinkering with UIViews (more than one on screen at a time with evidently different tasks -> thus different controllers) should (I'm tempted to say must) use iOS new ViewController-Containment features. Every implementation without that is simply bad as it tinkers with the view hierarchy in a way not intended by Apple.
On a sidenote: If you're really curious on how it can be done as close to Facebook's way as possible, check out the project I open sourced on Github PKRevealController .
Another option is to use Scringo . It gives you a side-menu like in youtube/facebook apps, and also all kind of built-in features in the menu that you can choose to add (e.g chat, invite friends, etc...)
Adding the side-menu is simply by calling [ScringoAgent startSession...] and all configuration can be done on the site.
If you want I did this repo on github GSSlideMenu It allow you to create a Facebook-style menu BUT with a "back" webView (generally all repos that I've found has a tableView as the "back" view).
This question is quite popular but it all came down to easy importing and use for me... Here is what I use... SWRevealController.
I'm surprised people miss it... It really is GREAT!!! and easy to use. The developer even includes a few example projects that allow you to see how to use it in different scenarios.
Try adding your menu (that you swipe to get to) underneath the main view. Begin subscribing to touch events in the view.
Implement
touchesMoved:
, and check to see if the firstgesture
is vertical (scroll the main view, if needed), or horizontal (here you'd want to show the menu). If it's horizontal, begin invoking another method,- (void)scrollAwayMainView:(NSUInteger)pixels
, whenevertouchesMoved:
gets called, calculating the number of pixels away from the starting point the main view should be, and passing that number into the method. In that methods implementation, run the following code: