2015-04-18 72 views

回答

1

您可以通過AlertViewController來完成。

這是我的忘記密碼方法,你可以從中獲得幫助。

@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) { 
    } 

} 

可以將它幫助你,

HTH,享受編碼!