Are view controllers with nib files broken in ios 8 beta 5?

前端 未结 7 1965
囚心锁ツ
囚心锁ツ 2020-12-01 21:46

I created a test project in ios 8 beta 4 which as a main view controller and a second view controller created as a UIViewController subclass with a xib file.

I put a

7条回答
  •  猫巷女王i
    2020-12-01 21:53

    I had a very similar problem on Xcode 10.1 and iOS 12.

    This code worked:

    class ExampleViewController: UIViewController {
    
        init() {
            super.init(nibName: "ExampleViewController", bundle: nil)
        }
    
    }
    

    But passing nil as nibName made it not load the XIB. When specifying the class name explicitly via @objc("ExampleViewController") this fixed it.

    The problem was caused by the module name starting with the letters 'UI' (the project was called UIKitExample). When I renamed the target to something else, this fixed the problem.

提交回复
热议问题