NavigationBar项目没有出现

时间:2018-06-28 15:19:52

标签: ios swift uinavigationcontroller

NavigationBar如果我的自定义ViewController被推送,则项目不会显示,只有以模态显示时才会显示。

出现导航栏,仅未显示项目。

如果按下VC,似乎找不到正确的NavigationController。

有什么想法吗?

The full Code on GithubFileExplorerViewController()在被按下时被调用)

致电:

final class DirectoryContentViewController: UICollectionViewController {    
    let editBarButtonItem = UIBarButtonItem(title: viewModel.editActionTitle, style: .plain, target: self, action: #selector(handleEditButtonTap))
        activeRightBarButtonItem = editBarButtonItem

扩展名:

extension UIViewController {
  var activeRightBarButtonItem: UIBarButtonItem? {
      get {
          return activeNavigationItem?.rightBarButtonItem
      }

      set(newValue) {
          navigationItem.rightBarButtonItem = newValue
          activeNavigationItem?.rightBarButtonItem = newValue
      }
  }

  var activeNavigationItem: UINavigationItem? {
      guard let viewController = navigationController?.topViewController else { return nil }

      if viewController.navigationItem === navigationItem {
          return navigationItem
      } else {
          return parent?.activeNavigationItem
      }
  }
}

1 个答案:

答案 0 :(得分:-1)

打开情节提要,选择所需的控制器,然后如图所示进行操作。嵌入导航控制器

enter image description here

其他方式是

Sub testFind()
    Dim cellAddy As String
    cellAddy = findNth(22, Sheets("myWkSheet").Range("A2:E13"), 7)

    If cellAddy = "" Then
        MsgBox "Match not found"
    Else
        MsgBox "Found in cell: " & cellAddy
    End If
End Sub