0

I have problems when using SWRevealViewController and scrollview. I created sidebar menu follow the instructions below (Swift 2.0 & XCode 7.): Sidebar Menu Tutorial Swift 2.0

You see the following picture:

SWRevealViewController conflict UIScrollView

How to handler it?. Any help would be appreciated, Thank.

The following is my code:

@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var menuButton: UIBarButtonItem!

override func viewDidLoad() {
    super.viewDidLoad()

    //revealViewController().delegate = self

    //self.scrollView.delegate = self


    // Do any additional setup after loading the view.

    let vc0 = FSMainSwipeVC(nibName: "FSMainSwipeVC", bundle: nil)

    self.addChildViewController(vc0)
    self.scrollView.addSubview(vc0.view)
    vc0.didMoveToParentViewController(self)

    //----
    let vc1 = FSDetailSwipeVC(nibName: "FSDetailSwipeVC", bundle:nil)

    var frame1 = vc1.view.frame
    frame1.origin.x = self.view.frame.size.width
    vc1.view.frame = frame1

    self.addChildViewController(vc1)
    self.scrollView.addSubview(vc1.view)
    vc1.didMoveToParentViewController(self)

    self.scrollView.contentSize = CGSizeMake(self.view.frame.size.width * 2, self.view.frame.size.height - 66);

    // Do any additional setup after loading the view.
    if self.revealViewController() != nil {
        menuButton.target = self.revealViewController()
        menuButton.action = "revealToggle:"
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

    }

}
Hoang Minh
  • 25
  • 4
  • did you mean that you cannot swipe back the sidebar? – Jacky Shek Mar 07 '16 at 07:39
  • yes, i can't . Swipe only works with UIScrollView – Hoang Minh Mar 07 '16 at 08:13
  • do you have any code for more information? because the tutorial seems correct. Also add your scrollview in viewdidload. – Jacky Shek Mar 07 '16 at 08:15
  • I did as instructed, it has been operating. however if they do not use UIScrollView – Hoang Minh Mar 07 '16 at 08:41
  • So you cannot swipe and work with left top item button? If yes, the reason is the UIScrollView has taken the interactive gesture and that is why you cannot swipe the UIScrollView. http://stackoverflow.com/questions/3648967/how-to-recognize-swipe-gesture-in-uiscrollview – Jacky Shek Mar 07 '16 at 08:49
  • Button "item" is still working. but the action of UIScrollView swipe replaced swipe action menu. I want to display the menu swipe left, swipe right shows the 2nd screen of UIScrollView – Hoang Minh Mar 07 '16 at 09:06
  • do you need horizontal swipe of scrollview? – Jacky Shek Mar 08 '16 at 02:47
  • try add `scrollVC.scrollView.scrollEnabled = NO;` into `viewDidAppear()` of your menuVC class – Jacky Shek Mar 08 '16 at 02:58
  • I want to use simultaneously both "swipe menu" and "swipe scrollview(scrollview contains two screens)". In scrollview when i swipe left display the menu, when i swipe right display the 2nd screen of scrollview. – Hoang Minh Mar 08 '16 at 07:47
  • In MenuTVC class, I've added viewDidAppear function and added code(FreeStyleVC.scrollView.scrollEnabled = false) (FreeStyleVC is scrollVC) and get compiler errors: "Instance member 'scrollView' cannot be used on type 'FreeStyleVC'" – Hoang Minh Mar 08 '16 at 07:58
  • Do you know any other way can swipe 2 viewController without conflit with swipe menu action of SWRevealViewController – Hoang Minh Mar 08 '16 at 08:15
  • the `errors: "Instance member 'scrollView' cannot be used on type 'FreeStyleVC'" ` means that it cannot recognize the scrollview. please check the code that can get the scrollview from your `'FreeStyleVC`. If you want to change plugin, i think there is no plugin that can solve your problem at this time. – Jacky Shek Mar 09 '16 at 01:00

0 Answers0