我在viewDidAppear中调用该方法,但是alertController永远不会出现,似乎没有理由。
func genderAlert()
{
let alertController = UIAlertController(title: "Quick Question:", message: "How would you describe yourself?", preferredStyle: UIAlertControllerStyle.alert)
let okAction = UIAlertAction(title: "Party Animal", style: UIAlertActionStyle.default) {
UIAlertAction in
print("Party animal Pressed")
}
let cancelAction = UIAlertAction(title: "Study Buddy", style: UIAlertActionStyle.default) {
UIAlertAction in
print("Study Buddy Pressed")
}
alertController.addAction(okAction)
alertController.addAction(cancelAction)
self.present(alertController, animated: true, completion: nil)
}