0

Like the iPad version. A sidebar menu always on the left and have few buttons on it. I have no clue how to make one like this. should I customise one myself? I find this tutorial http://www.appcoda.com/sidebar-menu-swift/, but on the step "control-drag from SWRevealViewController to the Menu view controller", seems not working for me.

AaoIi
  • 8,288
  • 6
  • 45
  • 87
Guan Nan Yao
  • 151
  • 1
  • 1
  • 9

1 Answers1

0

Okey to i've experienced the current library so what you have to do is the following in storyboard:

From document outline menu select Viewcontroller which is SWRevealViewController and ctrl-drag to the Menucontroller. it should work fine :)

enter image description here

Update :

First you should download the library from github called SWRevealViewController and integrate it with your app.then you will be able to see it in storyboard.

  • I added bridge.h file which uses the objective-c library into swift.

I've integrated the the library with the project and you may download it here : https://yadi.sk/d/Ux05nSgRioBzV

Update 2: To show the menu from the right you only have to :

1- set the segue identifier to : sw_right instead of sw_rear :

enter image description here

2- In your UIViewController change menuButton action from revealToggle into rightRevealToggle :

if self.revealViewController() != nil {
    menuButton.target = self.revealViewController()
    menuButton.action = "rightRevealToggle:"
    self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

}

Run it and it should work fine !

AaoIi
  • 8,288
  • 6
  • 45
  • 87
  • It said select “reveal view controller set segue”. But I don't have that option, – Guan Nan Yao Sep 01 '15 at 10:42
  • I have reveal view controller push controller and reveal view controller set controller – Guan Nan Yao Sep 01 '15 at 10:43
  • @Aaoli really appreciate, it works now, the description and the options i have are different, but all good now, thank you so much. – Guan Nan Yao Sep 01 '15 at 15:03
  • one more question, any idea about how to make the side bar on the right. found this [link](https://github.com/John-Lluch/SWRevealViewController/issues/185) but don't understand how. – Guan Nan Yao Sep 04 '15 at 17:56