【问题标题】:UIViewController has no member hidesBottomBarWhenPushedUIViewController 没有成员 hidesBottomBarWhenPushed
【发布时间】:2017-06-15 06:40:56
【问题描述】:

我突然开始收到这个编译器错误。昨天还好好的! (iOS 10.2)

“UIViewController”类型的值没有成员“hidesBottomBarWhenPushed”

在override func prepare(for segue: UIStoryboardSegue, sender: Any?) 中设置这个segue.destination.hidesBottomBarWhenPushed = true

更新:仅在模拟器上运行时才会发生。在实际设备上没问题。

【问题讨论】:

  • 你说的是哪个iOS版本?
  • @Varun iOS 10.2
  • 添加检查条件避免错误:if (segue.destination.responds(to: #selector(getter: UIViewController.hidesBottomBarWhenPushed))) { // Call hidesBottomBarWhenPushed in here }

标签: ios swift3 uicontainerview


【解决方案1】:

“XXX”类型的值没有成员“XXX”

在调用方法或设置不存在的属性值时,您会收到上述 Swift 编译器错误消息。

示例

/* Static members */
UIViewController.thisPropertyDoesntExist = true

UIViewController.thisMethodDoesntExist()

/* Instance members */
let vc = UIViewController()

vc.thisPropertyDoesntExist = true

vc.thisMethodDoesntExist()

解决方案

Xcode -> 产品 -> 清理构建文件夹并重新构建应用程序

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多