UITabBarController 初始视图?
我想知道是否可以在所有选项卡处于“向上”状态的情况下启动我的应用程序并向用户显示“登陆”视图。有点像欢迎/快速开始。当他们选择其中一个选项卡时,它会正常切换视图。
你能指出我正确的方向吗?
有点像这样:
I'm wondering if it is possible to start my app with all my tabs in the "up" state and show a "landing" view to the user. Kind of like a welcome/quick start. When they select one of the tabs, it switches views as normal.
Will you point me in the right direction?
Kind of like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是
UITabBar
/UITabBarController
,我认为您必须将selectedIndex
设置为某个合法值。我认为这是不可能的,我也无法在我的 iPhone 或 iPod 上找到可以模仿您正在寻找的行为的应用程序。(App Store 应用程序非常接近,它看起来在从互联网加载数据之前有一个空的选项卡栏,但很可能它们只是重复使用Default.png 并在加载过程中叠加活动指示器。)
请注意,如果您尝试将应用程序提交给 Apple,他们可能会因使用非标准 UI 而轻易拒绝它。
If you're using a
UITabBar
/UITabBarController
, I think you must have theselectedIndex
set to some legal value. I don't think this is possible, nor can I find an app on my iPhone or iPod that mimics the behaviour you're looking for.(The App Store app is as close as it gets, where it looks like it has an empty tab bar before it loads data from the Internet, but it could very well be that they are just re-using the Default.png and superimposing an activity indicator during loading.)
Note that if you tried to submit your app to Apple, they could easily reject it for using non-standard UI.
我可能会这样做的方法是创建一个仅用于此屏幕的新 ViewController,但确保它是由
UITabBarController< 管理的
viewControllers
数组中的最后 /代码>。这样,当您在屏幕上显示选项卡栏时,您会看到 4 个选项卡和更多按钮,但当前选定的视图控制器不在选项卡中,这意味着所有其他选项卡都未被选中。一旦用户满足了显示屏幕的条件,您就可以从选项卡栏中离散地删除视图控制器,而用户永远不会明智。
The way I would probably do this is to create a new ViewController that's just for this screen, but make sure it's last in the
viewControllers
array managed by theUITabBarController
. That way, when you show the tab bar on the screen, you get the 4 tabs and the more button, but the currently selected view controller is not in the bar, meaning that all of the other tabs are unselected.Once the user has satisfied the condition for showing the screen, you can discretely remove the view controller from the tab bar, and the user will never be the wiser.