ashishkakkad8 / akswiftslidemenu Goto Github PK
View Code? Open in Web Editor NEWSlide Menu (Drawer) in Swift
Home Page: https://ashishkakkad.com/
License: MIT License
Slide Menu (Drawer) in Swift
Home Page: https://ashishkakkad.com/
License: MIT License
if class use UITableViewController and i want use BaseViewController to add menu to this class
can't inheritance BaseViewController from UITableViewController class
I'm creating a shopping app, and this app has a shopping cart.
The shopping cart icon appears in most of the app's views always indicating how many items does the shopping cart has, it's a rightButtonItem inside a navigationItem.
It is now working properly. Except in the screens that are accessed using AKSwiftSlideMenu, the reason is because in all my other views I had to embed the destination view inside a navigation controller. The count of the shopping cart items is loaded when the app starts and it's stored as a global singleton that I access in all the viewDidLoads of my screens.
override func viewDidLoad() {
super.viewDidLoad()
var numeroProducto = String(Carrito.numProd)
navigationItem.rightBarButtonItem?.badgeValue = numeroProducto
}
To give the cart Button and a badgeValue I'm using the UIBarButtonItem + Badge framework.
The problem is that the AKSwiftSlideMenu uses these methods to segue.
func openViewControllerBasedOnIdentifier(_ strIdentifier:String){
let destViewController : UIViewController = self.storyboard!.instantiateViewController(withIdentifier: strIdentifier)
let topViewController : UIViewController = self.navigationController!.topViewController!
if (topViewController.restorationIdentifier! == destViewController.restorationIdentifier!){
print("Same VC")
} else {
self.navigationController!.pushViewController(destViewController, animated: true)
}
}
and
func slideMenuItemSelectedAtIndex(_ index: Int32) {
let topViewController: UIViewController = self.navigationController!.topViewController!
print("View Controller is : \(topViewController) \n", terminator: "")
switch(index) {
case 0:
print("Home\n", terminator: "")
self.openViewControllerBasedOnIdentifier("Home")
break
case 1:
print("Play\n", terminator: "")
self.openViewControllerBasedOnIdentifier("MiCuenta")
break
case 2:
print("Play\n", terminator: "")
self.openViewControllerBasedOnIdentifier("QuienesSomos")
break
case 3:
print("Play\n", terminator: "")
self.openViewControllerBasedOnIdentifier("NuestraCausa")
break
case 4:
print("Play\n", terminator: "")
self.openViewControllerBasedOnIdentifier("Contacto")
break
case 5:
print("Play\n", terminator: "")
self.openViewControllerBasedOnIdentifier("FAQ")
break
default:
print("default\n", terminator: "")
}
}
So the problem is that a new Navigation controller is instantiated programmatically when I segue using the slide menu, but I don't know how to change the badgeValue of that navigation controller, any ideas?
Hi.
Could you explain how to recall a UIViewController from a menu item and a UISplitViewController from another menu item?
Thank you.
Costantino
Hi,
Thanks for the work! But, I noticed a bug. To replicate:
Problem is with sender.tag use. I fixed it by checking iif (view.subviews.last?.restorationIdentifier == "SlideMenuView")
insted of checking for sender's tag. That seemed cleaner and more generic to me and also fixed the problem.
Also I made slidemenuvc a property of BaseViewController so that it doesn't initialize every time.
Expected expression in list of expressions on this line:
btnShowMenu.addTarget(self, action: #selector(BaseViewController.onSlideMenuButtonPressed(_:)), forControlEvents: UIControlEvents.TouchUpInside)
Hi, It's very hard to implement the Code and I would love if you could do CocoaPods or something else.
Is there a full example for the read me of how to get this framework up and running?
Please help.
Hello,
Thanks for your project, it is very helpful.
I can't manage to fix the top position of the side menu when the phone is in landscape mode.
If you test it, you'll see about 20 pixels between the nabber and the sliding menu.
Can you fix it or tell me how to do?
Best regards.
Alexandre
I'm seeing this issue on the view controllers that follow this format
class LocationViewController: BaseViewController, UITableViewDataSource, UITableViewDelegate
I'm not sure on what the issue could be, I've put the issue on stackoverflow as well with the code,
I would really appreciate any help given as I'm tearing my hair over this trying to debug!
https://stackoverflow.com/questions/44234036/blank-menu-button-with-swift-slide-menu
I implemented gradientcolor for the view ,i cant do blur effect is it possible from this API.
I have two navigation bar when I want to add item on the nav bar, I can't add item on nav bar, Please help me
Hi i want to add menu view controller should be on top of navigation bar, not below of navigation bar..please suggest me the updated code..
Hello I would like to change the colors of the btnMenu I would like the stripes to be green instead of blue, how could I do this? thanks
I wonder whether I can integrate a blog reader within this navigation drawer?
is there a way to cover the centre view with the side view partially as well as the navigation bar
Problem with scroll menu
@ashishkakkad8
i want to open sidemenu while swipe left to right but i did not find any solution and help.....
please help me to open sideMenu through swipe
Hi I have integrated your code in my application its working very nice, but I'm not able to remove custom pop up from application. when I remove using removefromsuperview screen is displaying blank. Please help me to resolve this.
Is this going to be updated for Swift3?
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.