0

Using SWRevealViewController, I made a slide view which appears from the right. It is supposed to be triggered by clicking a certain button on the navigation bar or sliding the screen right to left.

The view which appears is displayed in the center of the screenshot.

The problem is that it works only when slid to left, not the button clicked. The following is the code working with the sliding view, which is written in the UIViewController class for the view controller on the right in the screenshot.

The variable 'listBarBtn' is liked to the button with an image of three horizontal lines, a UIBarButtonItem in the right top of the same view.

listBarBtn.target = self.revealViewController()
listBarBtn.action =
    #selector(SWRevealViewController.rightRevealToggle(_:))
self.revealViewController().rightViewRevealWidth = 293
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

The second line was like the following one at first; I was suggested to change it by the compiler.

listBarBtn.action = Selector("rightRevealToggle:")

And here are the identifiers of the arrows between views:

Reveal View Controller->Vc imozomo Slide: sw_right (reveal view controller set view controller)

Reveal View Controller->Vc info Navigation: sw_front (reveal view controller set view controller)

Vc imozomo Slide->the view on the right with title in korean: myPage(reveal view controller push view controller. In a test project this did not require any identifier but prompted a warning message saying I need one)

enter image description here

Is there any code I have missed?


Yeongchan Jeon
  • 499
  • 3
  • 18

2 Answers2

0
listBarBtn.action = #selector(SWRevealViewController.rightRevealToggle(_:))

is fine.

does listBarBtn connect to your view controller as an IBOutlet? or does it cover with the bell image?

did you check the UIBarButtonItem is clickable?

Rurouni
  • 963
  • 10
  • 31
  • `listBarBtn` is linked like this: `@IBOutlet var listBarBtn: UIBarButtonItem!`, the list image does not cover the bell. And how can I check if the `UIBarButtonItem` is set as clickable? The attributes inspector doesn't show any attribute with title of 'clickable' or something similar to that. – Yeongchan Jeon Aug 01 '16 at 06:30
  • How about you add weak '@IBOutlet weak var listBarBtn: UIBarButtonItem!' and There is an checkbox option called "Enabled" when you select your bar button item in storyboard. – Rurouni Aug 01 '16 at 06:38
  • I added `weak` keyword but it didn't make any change. And the 'Enabled' checkbox was checked as true before I add the keyword. – Yeongchan Jeon Aug 01 '16 at 06:57
  • Reveal View Controller->Vc info Navigation: sw_front (reveal view controller set view controller) How about you try SWRevealViewControllerSeguePushController instead of SWRevealViewControllerSegueSetController – Rurouni Aug 01 '16 at 07:37
  • then the screen turns into black. The reveal view controller is linked from the initial view controller by a UIButton and it happens when I click the button – Yeongchan Jeon Aug 01 '16 at 07:57
0

Did you set the segue identifier as sw_right for right reveal. sw_rear will reveal left while the sw_right will slide the right menu. enter image description here

user2094867
  • 299
  • 2
  • 7