0

When you present (popover) a view controller the previous view controller kind of backs out of the screen. Is there any way to stop that from happenening.

Here is an example of what is happening: https://i.stack.imgur.com/pIVjy.jpg

And here is an example of what I want to happen: https://i.stack.imgur.com/Nlrpr.jpg

The only code I'm using for presenting it

let viewController = UIStoryboard(name: "StoryboardName", bundle: nil).instantiateViewController(identifier: "IdentifierName")
self.present(viewController, animated: true, completion: nil)

1 Answers1

0

If you want something like this:

First ViewController:

let sb = UIStoryboard.init(name: "Appointment", bundle: nil)
let popVC = sb.instantiateViewController(withIdentifier: "AppointConfirmationPopUpVC") as! AppointConfirmationPopUpVC
    
self.addChild(popVC)
popVC.view.frame = self.view.frame
self.view.addSubview(popVC.view)
popVC.didMove(toParent: self)

Second ViewController:

@IBOutlet weak var bottomView: UIView!

viewdidLoad()
{
  self.view.backgroundColor = UIColor.black.withAlphaComponent(0.6)
  showAnimate()
}

func showAnimate(){
    UIView.animate(withDuration: 0.2, delay: 0, options: [.curveEaseIn],
                   animations: {
                    self.bottomView.center.y -= self.bottomView.bounds.height
                    self.bottomView.layoutIfNeeded()
    }, completion: nil)
}

func hideAnimate()
{
    self.tabBarController?.tabBar.isHidden = false
    UIView.animate(withDuration: 0.2, delay: 0, options: [.curveLinear],
                   animations: {
                    self.bottomView.center.y += self.bottomView.bounds.height
                    self.bottomView.layoutIfNeeded()
                    self.view.center.y += self.view.bounds.height
                    self.view.layoutIfNeeded()
                    
    },  completion: {(_ completed: Bool) -> Void in
    })
}
Muhammad Aakif
  • 193
  • 2
  • 5