小编Mic*_*rek的帖子

没有让 navigationController?.pushViewController 工作但现在可以工作?

我确实有一个非 Storyboard、100% 编码的 UIViewController、UICollectionView 和 UICollectionViewCell - 工作完美。

这是有问题的代码:

SceneDelegate 不确定这是否相关。

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

        guard let windowScene = (scene as? UIWindowScene) else { return }
        window = UIWindow(windowScene: windowScene)

        let layout = UICollectionViewFlowLayout()
        layout.scrollDirection = .horizontal
        let myController = MyViewController(collectionViewLayout: layout)
        window?.rootViewController = myController
        window?.makeKeyAndVisible()
    }
.
.
Run Code Online (Sandbox Code Playgroud)

ViewController 非常简单直接......

class MyViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
    let data = loadOnboardingData()
.
.
override func viewDidLoad() …
Run Code Online (Sandbox Code Playgroud)

swift4 swift5 ios13 xcode11

5
推荐指数
1
解决办法
1336
查看次数

标签 统计

ios13 ×1

swift4 ×1

swift5 ×1

xcode11 ×1