jonkykong / sidemenu Goto Github PK
View Code? Open in Web Editor NEWSimple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
License: MIT License
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
License: MIT License
@jonkykong first of all, thanks so much for this great library!
I was just wondering how to populate the side menu table view controller from a swift array. Where should the datasouce/ delegate be placed so that the different options can appear in the side menu?
Thanks!
SideMenuManager.menuLeftNavigationController = Table 1 .. Dashboard 1
SideMenuManager.menuLeftNavigationController = Table 2 .. Dashboard 2
Crash..
I have used following to avoid above error!
INSTEAD OF using this -
presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)
I have used this -
performSegueWithIdentifier("segue_menu_controller", sender: self)
Hello. Thank you for library.
Can not understand what the correct way to open side menu from code.
Tried use some segue from root view controller and performSegueWithIdentifier(_:_:)
but menu just opened modally.
Thanks in advance.
Im implement codeless version of sidemenu on left and right sides.
When you reload page from left side menu(for example place button which handle presentviewController at same page), then try to open right side menu, it will crashes.
For easy demonstration, I'm using example project in SideMenu directory.
Example/SideMenu.xcworkspace
UINavigationController
Main.storyboard
as type of this new subclassUINavigationController
(This should simulate use case for programmatically set up rotation lock or different supported interface orientations for different devices e.g. iPhone only Portrait, for iPad Portrait and Landscape) override func shouldAutorotate() -> Bool {
return false
}
CMD
+ Left Arrow
Transition will respect current orientation of Initial Navigation Controller
Hi,
simple and really cool menu you did here. I have just one question. Is it correct that you can't have different menuWidth for left and right controller?
Best,
Lars
Hi, do you think it is possible to add in a delegate, to inform the view controllers about when it will start presenting the side menu, and also when the side menu has been completely presented? Same goes to when closing the side menu. It would be help if that's added. Many thanks.
In my project there is following hierarchy:
vc - viewController
nc - navigationController
sm - sideMenu
nc1 - vc1 - ncSM - vcSM - nc2 - vc2
when call "presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)" from vc2, there is following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <____: 0x7fa0148a7400>
how can I solve the problem?
The modalPresentationStyle configured with OverFullScreen cause window hierarchy when present another viewController over this.
Replace all .OverFullScreen to .OverCurrentContext to fix it.
Thanks. :-)
Hi,
i'm very glad to use SideMenu, it looks fantastic!
During testing of my app, the line in presentMenuStart func:
let mainViewController = SideMenuTransition.viewControllerForPresentedMenu!
Cause an EXC_BAD_INSTRUCTION error when i rotate the device. Looking at issues, i tried to update pod and to init menu in AppDelegate without solving the problem.
Thanks
I see the SideMenuNavigationController overrides pushViewController:animated:
and calls the parent's navigation controller, which is almost always the behavior you want. But what if you want to actually transition within the sidebar itself?
let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: SideMenuViewController())
menuLeftNavigationController.leftSide = true
// UISideMenuNavigationController is a subclass of UINavigationController, so do any additional configuration of it here like setting its viewControllers.
SideMenuManager.menuLeftNavigationController = menuLeftNavigationController
The code above let me open the side menu, but its empty. It should have root controller = SideMenuViewController(). It never loaded.
I tested SideMenuViewController and it display just fine anywhere else.
When i click UIBarButton side menu appears black. I did not changed any default settings. Where am i wrong? Can you help me with that issue? I am new with swift. Thank you in advance!
conversationsViewController.conversationsViewControllerDelegate = self
SideMenuManager.menuLeftNavigationController = conversationsViewController
SideMenuManager.menuPresentMode = .ViewSlideInOut
SideMenuManager.menuFadeStatusBar = false
SideMenuManager.menuWidth = max(round(min(UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height) * 0.85), 240)
SideMenuManager.menuShadowOpacity = 0
SideMenuManager.menuRightSwipeToDismissGesture = nil
SideMenuManager.menuLeftSwipeToDismissGesture = nil
SideMenuManager.menuAnimationPresentDuration = 0.25
SideMenuManager.menuAnimationDismissDuration = 0.25
As you can see I've set both swipe gestures to nil
however, I'm still able to swipe and dismiss the controller. What am I doing wrong?
If we rotate device while SideMenu
is on screen with MenuPresentMode
equals to InOut
& MenuTransformScaleFactor
equals to less than 1
we'll catch a bug: MainViewController
will be cut out his height.
Hello,
I fell into a crash/bug in the example demo.
When you swipe on the left edge, if you are in middle of swiping (= do not release your finger) then clicking (once or repeatedly) on a cell in the table ("Push View Controller 1"), the app simply freezes after releasing any touch.
More clearly :
The app is frozen !
Can you investigate this problem ?
Thank you !
Hey,
The SideMenu has been working great. I have a tableView with static cells for my sidemenu, however, when I'm in landscape mode the menu doesn't scroll so the bottom part is inaccessible. I know the entire menu won't fit on screen in landscape but do you have a recommendation on how to make it so it will scroll in landscape?
Thanks!
Hi,
I would like to disable the SideMenu pan gesture recognizer for particular view controllers.
Do yoy know a proper way to do that ?
Thanks !
How can i use side menu without using navigationcontroller... here i need only one button.. how can i deal with this.. i tried for that i need your confirmation weather it can be done or not..
Could you add please support of Carthage.
Hey, great work with this menu!
I have a project without storyboard, so I cant use segues. I did manage to make it work using pushViewController but the first time I click the cell on the menu the push fails, on the second time and afters it works just fine.
Maybe I set something wrong and after the first click your code fix it. Can you Make a sample without a storyboard?
Thanks
I love SideMenu but when I included it in XCode 8 (announced in WWDC2016) using Cocoapods (use_frameworks), it reported an error, saying that the framework was compiled with an earlier version of compiler. Can you provide one compiled with XCode 8?
Hi jonkykong, your side menu is awesome, looks really smooth and responsive. My purpose is to build a menu similar to that of Lyft or Uber: each child view controller should be able to call this menu independently without a intermediate step to go back to "home" screen. In your example, each child view controller is triggered by a push segue but then the menu button just redirects me to the main screen instead of the menu. In my own code, I used
presentViewController(SideMenuManager.menuLeftNavigationController!, animated: true, completion: nil)
for the menu button but the automatic generated "back" button will always should on the top of my menu button to prevent me from doing the right thing and then I will go back to the initial screen... Is there any neat way to make your menu behave like a normal slide-out menu?
Hi!
There's a visual glitch when you close either one of the side menus by swiping as if you were throwing the menu way. In other words, beginning the swipe and releasing the finger before the menu is fully closed.
@jonkykong thanks for creating a very nice/handy class. I have tried it and works just fine, but is not working properly for Swift 3 projects.
I did a quick test using the suggested migration (via Xcode) and managed to get it running, but got some bugs (not displaying the menu as it suppose to) and other issues.
The key part is, are you working on the Swift 3 version? Or should I fix it myself and do a Pull Request?
Hello,
Congratulations on your work, works fine for iPhone 5+, but fot iPad and iPhone 4s when I am using at landscape the menu doesn't get the right size, neither the main view controller.
If you can help me solve this, or give tips where I can correct it myself I will be very happy.
Kind Regards
When I make click on the bottom for display the menu, show me the following error:
Failed to set (barPosition) user defined inspected property on (UINavigationItem): [<UINavigationItem 0x13dd98d60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key barPosition.
Any Help?
Thank you for your interest in SideMenu!
I have received a surprising amount of questions about SideMenu since putting it up here. A few people in the community have identified some problems and helped contribute to SideMenu to make it better for everyone and I'm truly grateful for the support! Keep them coming!
I have also received a number of questions about people having issues implementing SideMenu, mostly from beginners learning how to code. As much as I would love to help all of you, I simply do not have the time to teach you. That's why I spent a lot of time putting together a detailed README, adding comments about usage in code, and providing a demo project. These will give you all the information you need to work through any problem and also save me the time it takes to personally respond. It is faster for you to figure it out for yourself instead of waiting for me to respond to you.
Again, please do not email me or open any issues if you want to know how to use SideMenu or are having trouble getting it to work. However, if you think you found a bug, open an issue and I will respond to it as quickly as I can. You should be able to demonstrate the bug in the demo project which has a minimal amount of code.
Thanks again for your support and for being respectful of my time.
I use sidemenu in the tabbarcontroller, when i click the tablecell in the sidemenu, the console display "warning:attempting to push a viewcontroller from a viewcontroller that doesn't have a NavigationController...."
Hello,
Thank you for this ready-to-use pod !
I am displaying a static table view in the sidemenu. I would like to perform a push segue from a cell of the SideMenu.
How and where can I implement a Navigation Controller to perform a push segue ?
Thanks !
Here is my code :
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath)
// get cell identifier if it exists (otherwise, quit the function)
guard let cellIdentifier = cell?.reuseIdentifier else {return}
switch cellIdentifier {
case "settings":
performSegueWithIdentifier("SettingsSegue", sender: self)
case "help":
if let url = NSURL(string: "http://www.google.com/") {
UIApplication.sharedApplication().openURL(url)
}
case "signout":
performSegueWithIdentifier("SignInSegue", sender: self)
case "deleteaccount":
performSegueWithIdentifier("SignInSegue", sender: self)
default: break
}
}
Hi,
Your side menu is great. But when I create a tableview to implement side menu, it has a navigation bar on top. How could I remove it for my sidemenu looks better ?
Hi, I'm new of cocoa pods. I'm trying to install following signs but when I try to perform "pod install" console say to me "[!] Unable to find a specification for SideMenu
". Why? thank you
在iOS8中,menuAddScreenEdgePanGesturesToPresent 设置左边手势,没效果,如果用menuAddPanGestureToPresent,则滑到右边缘再离开屏幕(或关闭的时候左滑到左边缘),会闪一下屏,具体表现为:快速关掉测滑页,然后马上再打开测滑页。
What is the appropriate way to present a view controller from the menu when a row is selected (using TableViewController? Right now I am pushing modally (cover up presentation) based on the selected row, but I'd prefer it to just change whatever controller that was pushed to the side when the menu is displayed and then hide the menu when the row is selected.
Does that make sense?
When the menu is shown, I want to dim the presenting view by changing its background color. I am happy to submit a PR for this. There are two ways we could do this:
menuContainerBackgroundColor
property to SideMenuManager. Then it would handle the presenting view background color change as part of its animation.menuAnimationPresentDuration
or menuAnimationDismissDuration
for the duration.Any preference?
I have successfully implemented SideMenu by following the steps in the GitHub page. It's Working fine. But amGetting this error right now. So When It occurred...
I have Different items to display in my Menu list like , Home , Profile , Log Out etc..
for that I am using different cells and created segue's from each cell . The First Screen to Display when i run the project is the Home Screen. Then using a Button or gesture I revealed the SideMenu and from the Items in the Menu when I click on the Cell which Navigates back to home I get the error mentioned in the title inside the function hideMenuStart at this line
let mainViewController = SideMenuTransition.viewControllerForPresentedMenu!
... How to fix this.. I am new to iOS...
Application crashes for me after touching home button.In SideMenuTransition.hideMenuStart() SideMenuTransition.viewControllerForPresentedMenu! controller is nil.
My init looks like:
let leftViewController:UISideMenuNavigationController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("UISideMenuNavigationController") as! UISideMenuNavigationController
SideMenuManager.menuLeftNavigationController = leftViewController
SideMenuManager.menuAddScreenEdgePanGesturesToPresent(toView: self.view)
SideMenuManager.menuPresentMode = .MenuSlideIn
SideMenuManager.menuAnimationBackgroundColor = UIColor.clearColor()
How can I get central view controller from left or right menu controller?
Hi jonkykong,
Do you have documentation on how to pass data between the SideMenu and the MainView?
it can't touch right part to shutdown SideMenu.
当使用QLPreviewController放在我的Controller里时,拉出SideMenu,不能点击右侧遮罩处关闭SideMenu。因为能直接操作QLPreviewController。
How can I dismiss my left view without poping or pushing my main view controller?
Although the pan gesture works from right-side, the animation starts from the left-side.
I'm trying to install via Cocoapods and keep getting this: "Unable to find a specification for SideMenu (~> 1.1)
" after running pod install. I have no issues installing other cocoa pod frameworks, not sure why it can't find it! I've tried running both: pod 'SideMenu' and pod 'SideMenu', '~> 1.1'
左边菜单中,不能使用左滑右滑手势,。左边菜单中tableview不能使用左滑删除
the menu on the left, can't use hand gestures ,. tableview in leftMenu can't use left slide to delete
SideMenuManager.menuAnimationBackgroundColor = UIColor(patternImage: UIImage(named: "stars")!)
how to make it fit on the screen?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.