Please clear some confusions regarding UIViewController

后端 未结 1 1878
轮回少年
轮回少年 2020-12-07 06:22

Please clear some confusions regarding UIViewController

I found this article Abusing UIViewController and here are the links link1 & li

相关标签:
1条回答
  • 2020-12-07 07:07

    Container view controllers (like UINavigationController) allow working around the one-VC-per-screen rule. Since iOS 5, developers have been able and allowed to write our own container controllers (which aren't actually much different from normal VCs). Generally this means that writing non-VC controller objects is less necessary than it used to be.

    In your situation, where you want to replace the root view controller, your option 2 makes more sense. Use VCs where you can, and non-VC controller objects only when you can't. Since you're replacing the whole screen's content, just switching the UIWindow rootViewController makes the most sense (edit: alternately, many devs would just use a navigation controller to present the second view, because it's simple and convenient).

    0 讨论(0)
提交回复
热议问题