Displaying a message in iOS which has the same functionality as Toast in Android

前端 未结 19 1732
逝去的感伤
逝去的感伤 2020-12-12 12:35

I need to know if there is any method in iOS which behaves like Toast messages in Android. That is, I need to display a message which is dismissed automatically after few se

19条回答
  •  半阙折子戏
    2020-12-12 13:13

    Swift 4 syntax for a 3-second delay:

    present(alertController, animated: true, completion: nil)
    
    DispatchQueue.main.asyncAfter(deadline: .now() + 3) {                 
        self.dismiss(animated: true, completion: nil)     
    } 
    

提交回复
热议问题