SWRevealViewController close rear view when tapping front view

前端 未结 9 1619
夕颜
夕颜 2020-12-09 04:18

I am using SWRevealViewController in order to implement a side nav menu in my app. I would like to make it so that the front view cannot be interacted with when

9条回答
  •  难免孤独
    2020-12-09 05:01

    In ViewDidLoad of your frontViewController you need to add a UITapGestureRecognizer

    SWRevealViewController *revealController = [self revealViewController];
    UITapGestureRecognizer *tap = [revealController tapGestureRecognizer];
    tap.delegate = self;
    
    [myView addGestureRecognizer:tap];
    

    This should cause the rear view to close when the front view is tapped which is SWRevealViewController's default behaviour.

提交回复
热议问题