Closed FedericoSub closed 6 years ago
Because you are setting rightViewRevealWidth when right menu is still open and in this case the behaviour of PBRevealViewController is to change the MainViewController and rightViewController frames causing the bug...
Solution 1: In your MainViewController, check the rightViewRevealWidth value:
self.revealViewController()?.isRightPresentViewOnTop = false
if revealViewController()?.rightViewRevealWidth != 210 {
revealViewController()?.rightViewRevealWidth = 210
}
Solution 2: Set rightViewRevealWidth in your right menu controller:
override func viewDidLoad() {
super.viewDidLoad()
revealViewController()?.rightViewRevealWidth = 210
// ...
Solution 3 (the better one): Keep a reference to your main view controller (Home) to not instantiate and load it each time from storyboard.
Thankx ..later I'll try your solution.... Just a information ..what do you mean "Keep a reference to your main view controller (Home)" ? can you give me a example ? thanx
Yes, you will also see in this sample the use of PBRevealViewDelegate protocol:
Thanks a lot now works well
Hi again I need your help again for same app. :-( I made a new VC called ProfiloROTableViewController where I make the Navbar transparent with a nice aspect. If I call from ProfiloRO this VC with : performSegue(withIdentifier: "segueProfilo", sender: self)
all works and you see the navbar button but if I try to link using PBRevealViewController navbar item disappeared like in picture attached. Archivio.zip
the code to call the VC from MenuTableViewController is : if cell.vociMenuLbl.text == "ProfiloRO" {
let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let desController = mainStoryboard.instantiateViewController(withIdentifier: "ProfiloROTableViewController") as! ProfiloROTableViewController
let newFrontViewController = UINavigationController.init(rootViewController:desController)
revealViewController.pushMainViewController(newFrontViewController, animated: true)
Any idea how to make navebar item visible ?
thanks again
I think you have just to remove
bar.alpha = 0.0
in your ProfiloROTableViewController
Great work !!! just another question... If from this VC tap the Botton "Modifica Profilo" I open a new VC where I change and save some value about my Profile. After save data i need to return to this previous page. I use a back button with Unsegue return , but if I'd like to RELOAD the ProfiloROTableViewController how I can this ?
I tried with: let mainStoryboard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let desController = mainStoryboard.instantiateViewController(withIdentifier: "ProfiloROTableViewController") as! ProfiloROTableViewController let newFrontViewController = UINavigationController.init(rootViewController:desController) revealViewController.pushMainViewController(newFrontViewController, animated: true)
but don't work
thanx for any suggestion .. Federico
When you tap on "Modifica Profilo" button, how do you present the new VC? (push, present modal)?
In ProfiloROTableViewController, in viewWillAppear, reload the data for the tableView and the collectionView.
self.tableView.reloadData() self.collectionView.reloadData()
So, when you come back from the new VC, your datas will be updated on the view.
DO NOT re-instantiate a ProfiloROTableViewController!
thanxs again
Hi I'm starting with my new app for IOS in Swift and I'd like to use this Menu but there's something that doesn't work when I set this: revealViewController()?.rightViewRevealWidth = CGFloat(Float(210)) If I use the default all works with right menu but if i try to change with a width doesn't work. When the right menu is open if i click un HOME label the left VC didn't pushed on left and the left VC become Dark like in Picture. As I said if I commented the row with CGFloat(Float(210) all works . This is MainViewController : class MainViewController: UIViewController {
and this MenuViewController: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let revealViewController:PBRevealViewController = self.revealViewController()! let cell:MenuTableViewCell = tableView.cellForRow(at: indexPath) as! MenuTableViewCell
As I said if I click "Home" this is the effect
Any suggest ? thanks