当我使用 -initWithNibName:bundleName: 初始化 UISplitViewController 时,为什么它是黑色的?
苹果在参考文献中说我应该使用-init。但这似乎违反了始终使用指定初始化程序的约定。因为它没有任何一个,所以它将是来自超类 UIViewController 的一个,对吧?如果我现在完全清醒的话,那就是 -initWithNibName:bundleName:。
然而,当使用 nil 和 nil 调用它时,UISplitViewController 是全黑的。当我调用 -init insetead 时,它工作得很好。别明白。
Apple says in a ref I should use -init. But that seems to go against the convention of always using the designated initializer. Since it doesn't have any, it would be the one from the superclass which is UIViewController, right? And there, it is -initWithNibName:bundleName:, if I'm fully awake right now.
However, when calling that with nil and nil, the UISplitViewController is fully black. When I call -init insetead, it works perfectly. Don't get it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅此处:将 UISplitViewController 放在自己的 XIB 中?
可能会有所帮助你。看来你不能也不应该那样做。我在尝试时遇到了同样的黑屏。把它放到主 XIB 上就可以了。不过很奇怪。
哦,还看到这个: UISplitviewcontroller not as a rootview controller
它增强了我的信念:这是不可能的。奇怪的。
勒内
See here: Stick UISplitViewController in its own XIB?
Might help you. It seems you just cannot and should not do it that way. I'm experiencing the same black screen when trying it. Put it to the main XIB and you're fine. Weird though.
Oh, and also see this: UISplitviewcontroller not as a rootview controller
It strengthens my belief: it is not possible. Odd.
René
就我而言,我没有打电话
,
导致黑屏。我正在初始化它,因为
添加
[window makeKeyAndVisible];
解决了问题。In my case, i was not calling
after
which caused the black screen. I was initializing it as
Adding
[window makeKeyAndVisible];
fixed the problem.