이 기능은 내 viewDidLoad
에서 호출됩니다. 오류는 발생하지 않지만 아무 일도 일어나지 않습니다. 내가 인쇄하라고 명령했기 때문에 그것은 확실히 불려지고있다.신속하게 팝업하는 데 문제가 없습니다.
func makeAlert()
{
let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
// Create the actions
let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default) {
UIAlertAction in
NSLog("OK Pressed")
}
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel) {
UIAlertAction in
NSLog("Cancel Pressed")
}
// Add the actions
alertController.addAction(okAction)
alertController.addAction(cancelAction)
// Present the controller
self.presentViewController(alertController, animated: true, completion: nil)
봅니다 ViewDidAppear에 makeAlert()를 호출 할 수 있습니다. –
그 덕분에 너무 많이 일했습니다. – Steve
다행니다. viewDidLoad에 많은 코드를 넣지 마십시오. 그렇지 않으면보기 전환으로 지연됩니다. –