Show Toast message in UITableViewController with scroll

北城以北 提交于 2020-05-16 08:38:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!