TabBar控制器问题
我有一个应用程序,其中有四个选项卡栏控制器视图。当应用程序启动时,所有四个都是通过 SQL select 语句加载的。如何告诉它不要在启动时加载这些控制器,而是在我从第一个屏幕中选择一个值时加载这些控制器?
谢谢 韦斯
I have an app that has four tabbar controllers views in it. When the app starts up, all four are loaded via SQL select statements. How do I tell it not to load these controllers at startup, but to do it when I select a value from the first screen?
thx
wes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您将 4 个 ViewController 放入一个 TabBarController 中。如果是这样的话,为什么要推迟加载呢?实际的视图(通常是 ViewController 的“重”部分)不会加载,直到您在选项卡栏中实际选择一个视图将其向前推进(我认为这就是您正在寻找的行为)。
UIViewController 类的全部要点(嗯,无论如何,都是要点之一)是允许您将视图放置在层次结构中,而无需创建所需的所有 UI 元素,直到实际显示它为止。这使得应用程序组织变得更加容易。
I'm assuming you have 4 ViewController placed into a single TabBarController. If this is the case, why do you want to defer loading? The actual views (usually the 'heavy' part of the ViewController) are not loaded until you actually select one in the tab bar to bring it forward (which is, I think, the behavior you're looking for).
The whole point of the UIViewController class (well, one of the points, anyway) is to allow you to place your view in a hierarchy without having to create all the UI elements required until it's actually time to show it. This makes app organizations much easier.
在选项卡栏中制作简单的 UIViewController,但是当选择选项卡时进行加载
make simple UIViewController in tabbar, but when tab is selected make loading