Search code examples
iphoneswiftuiviewpopupuipopovercontroller

How to Create Custom PopUpView in ios8 & ios7?


I try to create subview inside a view but view is get full screen present view

i Want to create this type of view in subview. i want to customised this Subview as PopUp vIew.as my below Screen shot show.

so Can any one guide me through that Whether its possible to Customised Subview As PopupView?


Solution

  • You can do it by AlertViewController.

    Here is my Forgot Password method, you can get help from that.

    @IBAction func forgotpwd(sender: AnyObject) {
        let alertController = UIAlertController(title: "Forgot Password", message: "Enter Your Email.", preferredStyle: .Alert)
    
        alertController.addTextFieldWithConfigurationHandler { (textField) in
            textField.placeholder = "Enter your Email"
            textField.keyboardType = .EmailAddress
        }
    
        var yesAction = UIAlertAction(title: "YES", style: UIAlertActionStyle.Default) {
            UIAlertAction in
            //Do you Success button Stuff here
        }
    
        var noAction = UIAlertAction(title: "NO", style: UIAlertActionStyle.Cancel) {
            UIAlertAction in
            //Do you No button Stuff here, like dismissAlertView
        }
        alertController.addAction(yesAction)
        alertController.addAction(noAction)
    
        self.presentViewController(alertController, animated: true) {
        }
    
    }
    

    May It help you,

    HTH, Enjoy Coding!!