ykyouhei / kydrawercontroller Goto Github PK
View Code? Open in Web Editor NEWSide Drawer Navigation Controller similar to Android
License: MIT License
Side Drawer Navigation Controller similar to Android
License: MIT License
Hi! I need to change the first view when the drawer loads (and the user still hasn't selected any tab or even open the drawer menu). It depends on the view the menu loads, i.e.: if I load login, then the profile should appear and the drawer should be available. How can I do it so it shows the profile and not a white screen? Thank you very much and excelent job with this framework.
how to replace the main view in storyboard? After clicking on the drawer?
I'm using the storyboard approach. It works as expected, however the first time that you open the drawer either by swiping / programatically, the animation stutters a bit. Succeeding actions have little to no stutter. I'm on iPhone 6+ and I'm concerned that this would be an issue on older devices.
HI,Thanks for your library.
How to use add drawer via code only,because in readme file,there is explanation only for storyboard and also "code" example is totally different.So can you please explain use of drawer menu via code as explained for "storyboard".
Hi. Thank you again for the awesome drawer.
I have a question. I want to setup drawer on right side. I am using your code example but it does not work ( when I clicked on Open button, No drawer displayed from right side)
drawerController.drawerDirection = .Right
drawerController.drawerWidth = 200
Do I have do anything in order to make Right-Drawer work?
Thanks!
Hi I´ve set up the project of a uitabcontroller and the drawer as the issue #41, but i have a view controller with a button action performing the next code
let drawer = self.navigationController!.parent?.parent as! KYDrawerController
drawer.setDrawerState(.opened, animated: true)
im getting this error "Could not cast value of type 'KYDrawerController.KYDrawerController' (0x1012c3b00) to 'renti.KYDrawerController' (0x100cb5db0)."
Hi !
First, it's a really nice project :)
Secondly, is it possible to easily change the position of the view ? I mean, the y origin.
Regards !
i got an error
Module compiled with Swift 2.3 cannot be imported in Swift 3.0
how to fix?
Hello,
Great library ! I was able to put the right drawer and the left drawer but I am not able to put the right and the left in the same time...
Do you think you could have an idea of how to do this ?
Thank you a lot !
Hi @ykyouhei,
thanks for the awesome library, jus wondering if you are supporting iOS7?
i use V.1.1.0
HI,
I followed the Interface Builder instruction, but i got this strange render and i didn't found anything to solve this
The KYDrawerController is the first controller after a modal segue (i can't place it at entry point because i've the login screen) and the problem appear with and without drawer width setted
the drawer is not apper when set
``drawerController.drawerDirection
= .Right
Hi guys !
It's me again. I tried to put a row in my tableView in the menu to perform a log out.
So I do that :
self.navigationController?.popToRootViewControllerAnimated(true)
But it doesn't work. I tried to put a button, in the navigation bar, it worked.
I don't know how to manage :/
EDIT : In fact, I can't access to the navigationController, because when I perform print(self.navigationController?.viewControllers)
, it returns nil
Cheers
I have upgraded my system and Xcode to 8.
When I am building app in iOS 10 with swift 3. KYDrawerController giving issue.
Can you please provide me support for swift 3.
First of all,Thanks for all of your hard work.Really love it to try.
Your gif image show that your view controller is also supported for embedding with UITabBarController.
But,I really need some help with demo project.So,Any Help with UITabBarController?Because i want to build App like Google+ current version for now.Plus,I want to navigate directly from left menu to uitabbar item.
Eg.,If I tapped one of the menu from left menu,it navigate to appropriate UITabBarItem
If you have anytime,can you take a look at this?because we all have our circumstances,our life.
So,Any Demo Example for that?Storyboard or code?
Any Help?Thanks.
Hello guys.
This Drawer is so good to use it. I like this style than others.
But I have a issue, I want to hide status bar when drawer is opened.
I override prefersStatusBarHidden but this is never called. even on viewDidLoad.
Could anybody help me to figure this out, Please?
Any help would be thankful.
Thank you for very awesome drawer. I have a question. Does KYDrawerController support State preservation/restoration?
Her's how I've implemented the library :
let drawerController = KYDrawerController()
drawerController.mainViewController = UINavigationController(
rootViewController: tabBarController
)
drawerController.drawerViewController = menuController
drawerController.drawerDirection = .Right
/* Customize
drawerController.drawerDirection = .Right
drawerController.drawerWidth = 200
*/
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = drawerController
window?.makeKeyAndVisible()
As you can see in the gif normally the menu should appear on right not left and also the tab bar color have changed normally it's orange not white.
How to use 'KYDrawerController' for supporting swift 3?
Hello Sir,
It's really a nice lib and easy to integrate slide menu, but here I am not able to update the main view from drawer view the view is always updated on drawer controller only.
For example, I have four views as follows:-
1- main
2- drawer
2.1 - in the drawer, there is two button menu ie signup and login
from the main menu I am able to access the drawer menu but when I used to click the menu button the view is updating on drawer menu only and the main view is as it is
any suggestion..!
Thank you
I'm using a tableveiw for the drawer and want to send the user to a different view controller when they select a cell. How/where do I add code for this? I'm trying to do it in the didSelectRowAtIndexPath for the drawer class, but nothing works.
Hi ykyouhei, I'm the author of KYDrawerController-ObjC. Someone send me a mail about this issue and I take sometime to investigate about this. See the above GIF for detailed information.
This implementation is like this:
- (IBAction)clickedOpen:(id)sender {
KYDrawerController *elDrawer = (KYDrawerController*)self.navigationController.parentViewController;
[elDrawer setDrawerDirection:KYDrawerControllerDrawerDirectionLeft];
[elDrawer setDrawerState:KYDrawerControllerDrawerStateOpened animated:YES];
}
- (IBAction)clickedOpen1:(id)sender {
KYDrawerController *elDrawer1 = (KYDrawerController*)self.navigationController.parentViewController;
[elDrawer1 setDrawerDirection:KYDrawerControllerDrawerDirectionRight];
[elDrawer1 setDrawerState:KYDrawerControllerDrawerStateOpened animated:YES];
}
This issue is cause by the update constraint process which drawerViewController’s frame is incorrect (not changed) after drawerDirection got changed. The constraints were changed correctly, but the frame of drawerViewController is not changed. Then performing the animation immediately will cause UI looks like the above.
Further more, I don't understand why you called updateConstraints
instead of other methods like setNeedsUpdateConstraints
or setNeedsLayout
because we don't override updateConstraints
method. updateConstraints
will use UIView
's default implementation which the behavior is not sure by myself.
Change from updateConstraints
to layoutIfNeeded
temporary solves this, but we still need further discussion.
if let drawerController = navigationController?.parentViewController as? KYDrawerController {
drawerController.setDrawerState(.Closed, animated: true)
or
drawerController.setDrawerState(.Opened, animated: true)
}
navigationController is nil here. So, drawer is not closing / opening.
pan gesture is working perfectly.
main view controller is tabbarcontroller
On first run of
drawerController.setDrawerState(KYDrawerController.DrawerState.Opened, animated: true)
to open the drawer, the drawer view controller has a slight vertical animation. Presumably, this is from a CGRectZero frame or something similar. Calls to drawerController.drawerViewController?.loadView()
or drawerController.drawerViewController?.view.layoutIfNeeded()
before display have no effect.
Current workaround is to open and close the drawer without an animation after application has finished launching.
drawerController.setDrawerState(KYDrawerController.DrawerState.Opened, animated: false)
drawerController.setDrawerState(KYDrawerController.DrawerState.Closed, animated: false)
but creates warnings in the debugger
Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x7ff262ed9870>.
Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7ff26305f600>.
Hello.
He started to develop the application. Really liked the implementation of DrawerController. When will support Swift 2.0?
Happy to do a PR to update this to swift 2
Hi kyo,
Thanks for your library, I'm wondering how can I use autolayout to update the drawer width ?
Thanks,
Ravi.
Hi !
I don't know if this is possible, but I have a tableview on the drawer and after select some cell, I want to change the view controller. Is it possible?
Like change the controller that is initially set on the KYEmbedMainControllerSegue.
thanks a lot,
Filipe Faria
pod --version
1.1.0.beta.1
Unable to satisfy the following requirements:
KYDrawerController (~> 1.1.5)
required by Podfile
How do I implement a drawer in my tab bar, right now my implementation renders my tab bar above the drawer, is it even possible to use this framework in a tab bar in the first place?
Hi,
KYDrawerController
is nice drawer.
but needed delegate, by drawer state like DrawerState.Opened
or DrawerState.Closed
func kyDrawerControllerStateChanged(state: DrawerState)
Can you please add this functionality?
Hello i have found one another issue the instead of Layouting the subviews of Maincontroller view, we have to layout subviews for the _ContainerView
.. because thats animating the Maincontroller with weired animation
public func setDrawerState(state: DrawerState, animated: Bool,block:(()->Void?)?) {
_containerView.hidden = false
let duration: NSTimeInterval = animated ? _kDrawerAnimationDuration : 0
UIView.animateWithDuration(duration,
delay: 0,
options: .CurveEaseOut,
animations: { () -> Void in
switch state {
case .Closed:
self._drawerConstraint.constant = 0
self._containerView.backgroundColor = UIColor(white: 0, alpha: 0)
case .Opened:
let constant: CGFloat
switch self.drawerDirection {
case .Left:
constant = self.drawerWidth
case .Right:
constant = -self.drawerWidth
}
self._drawerConstraint.constant = constant
self._containerView.backgroundColor = UIColor(
white: 0
, alpha: self._kContainerViewMaxAlpha
)
}
self._containerView.layoutIfNeeded() //Changed
}) { (finished: Bool) -> Void in
if state == .Closed {
self._containerView.hidden = true
}
if block != nil {
block!()
}
self.delegate?.drawerController?(self, stateChanged: state)
}
}
self._containerView.layoutIfNeeded()
instead of self.view.layoutIfNeeded()
//ChangedOne request for this great lib that is it possible to display drawer below Navigation bar ? so that it becomes side menu under Navigation bar.
I try to use via pod install
when run it have error "Unknown class KYDrawerController in Interface Builder file."
why it like that?
Hi. Why the example is separated into two sub-folders?
I'm a newbie to iOS and it's difficult to me to add this to my project...
I'm really confused.
Is there any complete tutorial?
Thanks.
Hey mate , is it possible to pass data to our viewcontroller ? if my code is look like this
drawerController.performSegueWithIdentifier("main", sender: nil) drawerController.setDrawerState(.Closed, animated: true, block : nil)
i am unable to pass data to my viewController as the segue perform from the drawerController, can we enhance this issue ?
Without any subviews the drawer controller works fine.
But when i added an imageview at the top center Horizontally.
Running the app on the simulator gives a blank Drawer Screen.
Any Idea why this may be Happening.
Hide tabbar on push is not working.
TabbarController -> KYDrawerController - > MyUITableViewController -> push to detail view
I want to hide the UITabBar on the detail View. It does work.
I have integrated notifications in my ios app and on click of the notification i should go to the detail screen from list screen. The first list screen contains menu with KYDrawerController and the second screen is pushed into the main viewcontroller's stack. And everything works fine when i click the menu button its opening the menu button and when i click on some item in list its going to the detail screen but when I click on the notification which will directly take me to detail screen and coming back from that screen and clicking the menu button its not opening the menu drawer controller. And when i checked with the debugger the tap method is calling and its going into the KYDrawerController methods. Something fishy is happening here. Kindly help me with some hints why this is happening ?
In order to prevent the menu from opening in specific ViewControllers I had to set the menu width to 0 and set it to .Closed when the delegate tells me it's been opened.
Besides not being elegant, the dark overlay appears for a slight moment.
Any other way around it?
Thanks.
hi,thanks first
i want to use it with a tabBarController like this
let drawerViewController = LeftViewController()
drawerController.mainViewController = UINavigationController(
rootViewController: configurationRootViewController()
)
drawerController.navigationController?.title = "tsing";
drawerController.drawerViewController = drawerViewController
/* Customize */
drawerController.drawerDirection = .Right
drawerController.drawerWidth = 300
and the configurationRootViewController like
func configurationRootViewController() -> UITabBarController {
let todayListCtrl = UIStoryboard(name: "tsing", bundle: nil).instantiateViewControllerWithIdentifier("todaySB") as! TsingTaskController
todayListCtrl.tabBarItem.title = "today"
todayListCtrl.tabBarItem.image = UIImage(named: "tabbar_me")?.imageWithRenderingMode(.AlwaysOriginal)
todayListCtrl.tabBarItem.selectedImage = UIImage(named: "tabbar_meHL")?.imageWithRenderingMode(.AlwaysOriginal)
let todayNavigationController = UINavigationController(rootViewController: todayListCtrl)
// Create `chatsTableViewController`
let focusCtrl = UIStoryboard(name: "tsing", bundle: nil).instantiateViewControllerWithIdentifier("focusSB") as! TsingFocusController
focusCtrl.tabBarItem.title = "focus"
focusCtrl.tabBarItem.image = UIImage(named: "tabbar_discover")?.imageWithRenderingMode(.AlwaysOriginal)
focusCtrl.tabBarItem.selectedImage = UIImage(named: "tabbar_discoverHL")?.imageWithRenderingMode(.AlwaysOriginal)
let focusNavigationController = UINavigationController(rootViewController: focusCtrl)
let tabBarController = UITabBarController(nibName: nil, bundle: nil)
tabBarController.viewControllers = [todayNavigationController, focusNavigationController]
return tabBarController
}
TsingTaskController , TsingFocusController are UITableViewController
the app is run, but draw is not work, can give me some point how make tabBar work, thanks
another thing , how to set drawer title ?
drawerController.navigationController?.title = "tsing";
no effect
Hi,
Thanks for the awesome project. Even more for sharing it with the community.
My scenario:
Since the orignal 'KYdrawerController' project only supports one side for the moment, so I am using a workaround for now.
I keep both side view controllers ready. Whenever user presses either of the button in navigation bar. I change the drawerViewController and drawerDirection properties with respective viewcontroller and direction.
It is working fine. The issue is when user presses the right menu button for the first time, it seems the viewcontroller takes a flight from far left side to the far right side first, then reveals itself from there.
Code for setting leftsidebar
Code for setting rightsidebar
Note: 1. It only happens for the first time. After that it runs fine.
2. I am using swift files in objective C project. (Dont think it matters though.)
Please suggest something.
Thanks.
Please support auto layout with drawerWidth for show on many device size.
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.