I am trying to add a mask view to my front view in case when my rear view appears and I have written the following code for it -
func revealController(revealController: SWRevealViewController!, willMoveToPosition position: FrontViewPosition) {
var maskView = UIView(frame: self.view.bounds)
maskView.backgroundColor = UIColor.grayColor()
maskView.alpha = 0.5
maskView.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
maskView.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
if revealController.frontViewPosition == FrontViewPosition.Right
{
maskView.removeFromSuperview()//this block is called but mask view is not being removed.
//maskView.hidden = true
print("asdvf")
}
else if revealController.frontViewPosition == FrontViewPosition.Left
{
self.view.addSubview(maskView)
}
}
My mask view is added to the super view but is not removed from the super view despite the removal block called. Why so?