- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在顶级应用程序上显示一个 ViewController,所以我使用下面的代码
let nextStoryBoard = UIStoryboard(name: "Menu", bundle: nil)
let menu = nextStoryBoard.instantiateViewControllerWithIdentifier("MenuView") as! MenuPanelViewController
UIApplication.sharedApplication().keyWindow?.rootViewController!.getTopViewController().modalPresentationStyle = .FullScreen
UIApplication.sharedApplication().keyWindow?.rootViewController!.getTopViewController().presentViewController(menu, animated: false, completion: nil)
当我使用 xCode 7 时一切正常,当我将 xCode 更新到 8.1 时,在 iPhone 6s/6s+/7/7+ 上我无法使用 tapRecognizer。
我认为我的问题与上述设备上的 3D Touch 有关。
最佳答案
请检查您的 getTopViewontroller() 是否正确返回。
这是我用来查找显示最多的 View Controller 的方法。
extension UIApplication {
class func topViewController() -> UIViewController {
return UIApplication.topViewController(base: nil)
}
class func topViewController(base: UIViewController?) -> UIViewController {
var baseView = base
if baseView == nil {
baseView = (UIApplication.shared.delegate as? AppDelegate)?.window?.rootViewController
}
if let vc = baseView?.presentedViewController {
return UIApplication.topViewController(base: vc)
} else {
return baseView!
}
}
}
关于ios - 无法在 TopViewController XCode 8.1、iphone6s/6s+/7/7+ 上点击显示的 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40714990/
我是基于 NavigationControl 的应用程序的委托(delegate)。 当我尝试访问 rootViewController 时 RootViewController *rootViewC
我正在使用下面的代码尝试更改 UINavigationController 中显示的 viewController: var mainStoryboard = UIStoryboard(name: "
我的项目运行顺利,但我不希望我的项目固定在右上角。有没有办法让 ECSlidingViewController 显示在其 topViewController 之上。 谢谢 最佳答案 我不久前看过这个。
我想使用 XCTest 对堆栈上的推送进行单元测试。 所以我执行了 XCTAssert(type(of: navigationController.topViewController) is Deta
我正在尝试从我的 appdelegate 中注入(inject)对 uitableviewcontroller 中属性的引用。第一个成功 - 我能够从我的 uitableviewcontroller
我一直在关注这些链接中的视频教程:https://www.youtube.com/watch?v=tJJMyzdB9uI , https://www.youtube.com/watch?v=HqFFj
这是什么原因造成的?我在 Xcode 4.3 上运行 iOS 5.1 并使用 Storyboard。 'NSInvalidArgumentException', reason: '-[WFTopTab
我是 Swift 的新手,我试图根据我正在学习的教程制作一个侧边菜单,但我遇到了这个错误。 “无法将‘UINavigationController’类型的值 (0x1026054a8) 转换为‘jac
我在将 objective-c 转换为 swift 时遇到问题。 对于我的火车,我转换了 MMPaper swift ,但在属性中: 目标-c - (void)interactionBeganAtPo
我正在尝试在最顶层的 ViewController 上添加一个 View 。它确实有效,但是当我尝试添加点击手势识别器时,该操作不起作用。这是我的代码,我使用共享实例调用此类。难道是因为对象没有被保留
我已经定义了一个类 NewViewController,它显示了一个用于在应用程序中添加新项目的屏幕,该项目被包装在 UINavigationController 中。我想在这个 UIViewCont
在我的旧 iPhone 4 (iOS 7.1.2) 上进行一些测试时,我在执行从初始 collectionView 到 tableView 的 segue 时遇到错误。 在 iOS 8 上一切正常,但
navigationController 如何在此代码中设置它的 topViewController(来自 CoreDataBooks 示例)?我假设在 NIB 文件中有一些映射,但是我无法通过查看此
我正在尝试从 VC 转换为嵌入在导航 Controller 中的 VC。 就我的目的而言,这两行代码似乎完成了同一件事,但我想知道它们之间的真正区别是什么以及一个是否对另一个有利。 为此... if
更新到 Xcode 7 后,我收到此错误“类型 UIViewController 的值没有成员 topViewController。”还有其他人遇到这个吗? topViewController 不再是
我正在为 iPhone 开发一个应用程序,我需要从 topViewController 发送消息至rootViewController . 一种解决方案可能是在导航堆栈中的每个 VC 中创建委托(de
我有一个类似于模态视图 Controller 的东西,我需要在其他 View Controller 上方显示它。我没有使用常规模式 Controller 功能(presentViewControlle
UINavigationController 有 3 个 Controller ,听起来都与我非常相似:topViewController、visibleViewController 和 presen
我的项目有以下场景: [Preview View Controller] --(Modal)--> Navigation Controller --(Top)--> [Photo Setting Vi
当创建自己的UIViewController容器时,是否可以为容器的rootViewController或topViewController提供导出。使用UINavigationController,
我是一名优秀的程序员,十分优秀!