问题
For the Toast message I am using Toast-Swift in swift 5, Xcode 11 from: Toast-Swift
But I have a problem with UITableViewController, when TableView has scroll, the message is displayed off the screen and the user cannot see the message.
// basic usage
self.view.makeToast("This is a piece of toast")
I appreciate your help to show the message correctly on screen. Regards.
回答1:
Present the toast in the table view's superview, instead of in the table view itself. If you're using a navigation controller this would be: self.navigationController?.view.makeToast("This is a piece of toast")
or alternatively you could use the window directly (although I wouldn't recommend this): self.view.window?.makeToast("This is a piece of toast")
Also, I highly recommend using a UIViewcontroller instead as UItableViewContoller has that problem self.view == self.tableview and cause this problem with scroll
来源:https://stackoverflow.com/questions/61688473/show-toast-message-in-uitableviewcontroller-with-scroll