ios - How to use SlideNavigationController in Swift? -
i need use slidenavigationcontroller in app project, can't show menu in navigationcontroller bar.
slidenavigationcontroller downloaded from: https://github.com/aryaxt/ios-slide-menu
here's code in appdelegate.swift:
var leftmenu = leftmenuviewcontroller() var rightmenu = rightmenuviewcontroller() slidenavigationcontroller.sharedinstance().leftmenu = leftmenu slidenavigationcontroller.sharedinstance().rightmenu = rightmenu slidenavigationcontroller.sharedinstance().menurevealanimationduration = 0.18 var leftbutton = uibutton(frame: cgrectmake(50, 50, 30, 30)) leftbutton.setimage(uiimage(named: "gear.png"), forstate: uicontrolstate.normal) leftbutton.addtarget(slidenavigationcontroller.sharedinstance(), action: "toggleleftmenu", forcontrolevents: uicontrolevents.touchupinside) var leftbarbuttonitem = uibarbuttonitem(customview: leftbutton) slidenavigationcontroller.sharedinstance().leftbarbuttonitem = leftbarbuttonitem slidenavigationcontroller.sharedinstance().title = "123234" let screenbounds:cgrect = uiscreen.mainscreen().bounds self.window = uiwindow(frame: screenbounds); var nav = slidenavigationcontroller.sharedinstance() self.window?.rootviewcontroller = nav; self.window?.makekeyandvisible();
can tell me how configure properly?
it turns out have use this:
var root = slidenavigationcontroller(rootviewcontroller: viewcontroller()) var leftmenu = leftmenuviewcontroller() slidenavigationcontroller.sharedinstance().leftmenu = leftmenu self.window?.rootviewcontroller = root
it's quite easy , slide button appear @ right place (inside navigation bar).
Comments
Post a Comment