使用滚动显示UITableViewController中的Toast消息

问题描述 投票:1回答:1

对于Toast消息,我在Swift 5,Xcode 11中使用Toast-Swift来自:Toast-Swift

但是UITableViewController出现问题,当TableView滚动时,该消息显示在屏幕外,用户看不到该消息。

// basic usage
self.view.makeToast("This is a piece of toast")

感谢您的帮助,以便在屏幕上正确显示该消息。问候。

ios swift xcode toast
1个回答
1
投票

在表视图的超级视图中而不是在表视图本身中显示吐司。如果您使用的是导航控制器,则为:self.navigationController?.view.makeToast("This is a piece of toast")或直接使用窗口(尽管我不建议这样做):self.view.window?.makeToast("This is a piece of toast")

© www.soinside.com 2019 - 2024. All rights reserved.