How to Toast message in Swift?

后端 未结 22 1142
暖寄归人
暖寄归人 2020-12-22 19:18

Is there any way to Toast message in swift ?

I have tried in objective c but could not find solution in swift.

[self.view makeToast:@\"Account create         


        
22条回答
  •  梦毁少年i
    2020-12-22 19:48

    What exactly you need is https://github.com/Rannie/Toast-Swift/blob/master/SwiftToastDemo/Toast/HRToast%2BUIView.swift .

    Download the HRToast + UIView.swift class and drag and drop to project. Make sure you check 'copy items if needed' on dialogue box.

      //Usage:
      self.view.makeToast(message: "Simple Toast")
      self.view.makeToast(message: "Simple Toast", duration: 2.0, position:HRToastPositionTop)
    
      self.view.makeToast(message: "Simple Toast", duration: 2.0, position: HRToastPositionCenter, image: UIImage(named: "ic_120x120")!)
    
      self.view.makeToast(message: "It is just awesome", duration: 2.0, position: HRToastPositionDefault, title: "Simple Toast")
    
      self.view.makeToast(message: "It is just awesome", duration: 2.0, position: HRToastPositionCenter, title: "Simple Toast", image: UIImage(named: "ic_120x120")!)
    
      self.view.makeToastActivity()
      self.view.makeToastActivity(position: HRToastPositionCenter)
      self.view.makeToastActivity(position: HRToastPositionDefault, message: "Loading")
      self.view.makeToastActivityWithMessage(message: "Loading")
    

提交回复
热议问题