I've a ViewController like PopUp but the View not stay in position that I wants.
I want that this View stay on the center of screen. The below screen show the View in storyboard with the constraints seted and the result on simulator.
AlertViewController.swift
class AlertViewController : UIViewController {
@IBOutlet weak var frameView: UIView!
@IBOutlet weak var btCancel: UIButton!
@IBOutlet weak var lblInfo: UILabel!
var delegate : AlertViewControllerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
self.frameView.layer.cornerRadius = 10
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
@IBAction func cancel(_ sender: Any) {
delegate?.cancelBt()
self.dismiss(animated: true, completion: nil)
}
}
MainViewController.swift (show)
let alertController = self.storyboard?.instantiateViewController(withIdentifier: "AlertVC") as! AlertViewController
alertController.providesPresentationContextTransitionStyle = true
alertController.definesPresentationContext = true
alertController.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
alertController.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
alertController.delegate = self
self.present(alertController, animated: true, completion: {})
EDIT
I tried this.
The result: (I did change the background color).