John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 988 forks source link

The Top part of ViewController doesn't appear normally #604

Open BasmaElias opened 8 years ago

BasmaElias commented 8 years ago

i have a left menu and the front view controller display normally when the app run but if i open the menu and choose any item the top part of the UIViewController doesn't display normally .. if i rotate the device and return it the top part of UIViewController be normal ..

13645237_296957087309344_8254403250975511914_n 13669183_296957073976012_7265278545717353461_n

and it is my code if let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ProtectedPageViewController") as? ProtectedPageViewController { let navController = UINavigationController(rootViewController: secondViewController) navController.setViewControllers([secondViewController], animated:true) self.revealViewController().setFrontViewController(navController,animated:true) self.revealViewController().setFrontViewPosition(.Left, animated: true) }

iDevelopper commented 8 years ago

555 should help you.

Otherwise, #603

BasmaElias commented 8 years ago

viewController displayed normally but self.revealViewController() equal nil and the menu button doesn't work

iDevelopper commented 8 years ago

Have you configured in your storyboard the controller to the class RevealViewController?

BasmaElias commented 8 years ago

yes , when i run app self.revealViewController() equal value then if i press menu button and go the any viewcontroller self.revealViewController() be nil

The code : self.revealViewController().revealToggleAnimated(true) if let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ProtectedPageViewController") as? ProtectedPageViewController { let navController = UINavigationController(rootViewController: secondViewController) navController.setViewControllers([secondViewController], animated:true) self.revealViewController().setFrontViewController(navController,animated:true) } if i delete self.revealViewController().revealToggleAnimated(true) , button will be work but the viewcontroller will not display normally

iDevelopper commented 8 years ago

You have just to set a target and an action for this button:

class ViewController1: UIViewController {

@IBOutlet weak var menuButton: UIBarButtonItem!

override func viewDidLoad() {
    super.viewDidLoad()

    menuButton.target = revealViewController()
    menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
}
BasmaElias commented 8 years ago

Thank you 😃 , its working now