1

When i open SWRevealViewContrtoller(Side Menu) from any ViewController(ex:HomeVC) at that time the Background ViewController(HomeVC) should be blur or darken.

lakshminarayana
  • 115
  • 1
  • 2
  • 8
  • Possible duplicate of [Creating a blurring overlay view](http://stackoverflow.com/questions/17041669/creating-a-blurring-overlay-view) – Ashish Thakkar Jul 28 '16 at 12:40
  • Create a method in your HomeVC that adds a blur overlay when the Side Menu Bar Button is clicked, then check if it is there and remove it in viewWillAppear – MSU_Bulldog Jul 28 '16 at 13:29
  • Thank u .. No need to create overlay view .just set that frontviewcontroller alpha Then its working fine. – lakshminarayana Aug 03 '16 at 06:07

2 Answers2

1

Thanks Finally i got the solution .

In Home view controller make these changes.

-(void)initialSetup
 {
   self.revealViewController.delegate = self;
 }
- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position
 { 
   if (position == FrontViewPositionRight) 
     {
       revealController.frontViewController.view.alpha = 0.5;
     }
   else
    {
      revealController.frontViewController.view.alpha = 1;
    }
 }
lakshminarayana
  • 115
  • 1
  • 2
  • 8
  • This will only work when someone clicks on the front view controller again, it wont work when someone navigates away from the frontVC. – Munib Dec 22 '16 at 02:25
1

This is a better way to do it, this way will make sure that when you tap on the menu and go to another segue the front view will still be updated.

In your MenuVC (the table View controller that lies behind and acts as a side menu). Add the following.

override func viewWillAppear(_ animated: Bool) {

    self.revealViewController().frontViewController.view.alpha = 0.5
}

override func viewWillDisappear(_ animated: Bool) {

    self.revealViewController().frontViewController.view.alpha = 1
}

This is a very basic implementation, but with this, you can also darken it, do more things etc. But I found this way to be the best, because it takes care of all edge cases (hopefully :D).

Munib
  • 957
  • 1
  • 14
  • 30