0

I have a front view and rear view using SWRevealViewController. I am new on this(SWRevealViewController).
When I tap the navigation menu button in front view, then I want completely full rear view but it is not coming.
I have tried but my rear view right most button is not showing. Is there any problem or I have to add something extra.
Here is my code :-
Front view :-

class HomeViewController: UIViewController,SWRevealViewControllerDelegate {

@IBOutlet weak var openSlideMenuView: UIBarButtonItem!

override func viewDidLoad() {
    super.viewDidLoad()


    if self.revealViewController() != nil {

        openSlideMenuView.target = self.revealViewController()
        openSlideMenuView.action = #selector(SWRevealViewController.revealToggle(_:))

       self.navigationController?.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
    }

}  

Thanks

Kishor Pahalwani
  • 1,010
  • 1
  • 23
  • 53

1 Answers1

0

In my setting I use UserDefault to set these two functions that are in my mainViewController.

If this is the answer you were looking for don't forget to except the answer.

func changeShadow (){
    let defaults: UserDefaults = UserDefaults.standard
    let shadowColor              = defaults.object(forKey: "shadowColorID") as? Int
    if shadowColor == 1 {
        revealViewController().frontViewShadowColor = UIColor.red
    }else if shadowColor == 2{
        revealViewController().frontViewShadowColor = UIColor.blue
    }else if shadowColor == 3{
        revealViewController().frontViewShadowColor = UIColor.green
    }
}


func changeReveal (){
    let defaults: UserDefaults = UserDefaults.standard
    let revealWidth              = defaults.object(forKey: "widthID") as? Int
    if revealWidth == 1 {
        revealViewController().rightViewRevealWidth = (view.frame.width / 5*4)
    }else if revealWidth == 2{
        revealViewController().rightViewRevealWidth = (view.frame.width / 6*5)
    }else if revealWidth == 3{
        revealViewController().rightViewRevealWidth = (view.frame.width / 7*6)
    }else if revealWidth == 4{
        revealViewController().rightViewRevealWidth = (view.frame.width / 8*7)
    }else if revealWidth == 5{
        revealViewController().rightViewRevealWidth = (view.frame.width )
    }
}

Look in your SWRevealViewController.h for this line 241

// Defines how much of the rear or right view is shown, default is 260.
// Negative values indicate that the reveal width should be computed by substracting the full front view width,
// so the revealed frontView width is kept constant when bounds change as opposed to the rear or right width.
@property (nonatomic) CGFloat rearViewRevealWidth;
@property (nonatomic) CGFloat rightViewRevealWidth; // <-- simetric  implementation of the above for the rightViewController

// Defines how much of an overdraw can occur when dragging further than  'rearViewRevealWidth', default is 60.
@property (nonatomic) CGFloat rearViewRevealOverdraw;
@property (nonatomic) CGFloat rightViewRevealOverdraw;   // <-- simetric implementation of the above for the rightViewController

// Defines how much displacement is applied to the rear view when animating or dragging the front view, default is 40.
@property (nonatomic) CGFloat rearViewRevealDisplacement;
@property (nonatomic) CGFloat rightViewRevealDisplacement;  // <-- simetric implementation of the above for the rightViewController
dscrown
  • 578
  • 1
  • 5
  • 21