【问题标题】:showMessage function for toast not appearing in XLPagerTabStripXLPagerTabStrip 中未出现 toast 的 showMessage 函数
【发布时间】:2019-05-19 13:51:58
【问题描述】:

我正在使用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() 不起作用。

请帮我解决问题。

【问题讨论】:

  • 能分享一下showMessage()的代码吗?
  • @TaimoorSuleman 我已更新问题请查找功能。
  • 哦。您正在为此使用 pod
  • 是的@TaimoorSuleman
  • 检查视图层次结构。视图是否显示在 XLPager 的视图后面

标签: ios iphone swift xcode macos


【解决方案1】:

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

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

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

【讨论】:

  • 子页面如何调用?
  • 使用视图控制器的对象可以调用它。
  • 你能举个例子吗?因为我是初学者。
  • 假设您在容器视图中添加了两个控制器。因此,使用这两个控制器的对象,您可以调用 showMessage 方法,因为该方法已添加到 UIViewController 的扩展中。
猜你喜欢
  • 1970-01-01
  • 2021-11-24
  • 1970-01-01
  • 1970-01-01
  • 2011-04-16
  • 2015-10-27
  • 2021-01-28
  • 2018-03-07
  • 2013-05-08
相关资源
最近更新 更多