首页 > 解决方案 > XLPagerTabStrip 中未出现 toast 的 showMessage 函数

问题描述

我正在使用XLPagerTabStrip,里面有两个子视图。在子视图中,我使用 showMessage 函数打印错误消息的 toast,但视图中未显示 toast。

if ( debit_amount > availBal_Amount )
{
    self.showMessage("NO_SUFFICIENT_BAL", type: .error, options: [.position(.bottom),.textNumberOfLines(0)])
}

这是 showMessage 函数:

open func showMessage(_ text: String,
                      type: GSMessageType,
                      options: [GSMessageOption]? = nil) {
    GSMessage.showMessageAddedTo(text: text, type: type, options: options, inView: view, inViewController: self)    }

仅在XLPagerTabStrip视图showMessage()中不起作用。

请帮助我解决问题。

标签: iosiphoneswiftxcodemacos

解决方案


我使用了以下代码,消息将显示在容器视图上。为此在 viewController 中创建了一个对象。

let child_3 = ChildExampleViewController(itemInfo: IndicatorInfo(title: " ACCOUNT", image: UIImage(named: "profile")))

child_3.showMessage("nemessage", type: .error)

它为我工作。


推荐阅读