如何隐藏 UITabBarController 直到第一次调用第一个视图上的 webViewdidFinishLoad
我有一个基于选项卡栏控制器的应用程序,它有四个视图。我在 AppDelegate 中加载了一个启动屏幕,在一段时间后显示选项卡栏,如下所示:
// Show tab bar [窗口addSubview:tabBarController.view];
我想做的是保持启动屏幕可见,并且仅在第一次执行 FirstViewController.m 中的 webViewDidFinishLoad 委托后,在加载的第一个视图中显示 tabBarController 。
有什么办法可以做到这一点吗?我刚刚学习如何做到这一点,到目前为止,我似乎对我尝试实现这一目标的任何代码都没有运气。但是我仍然不知道如何隐藏和显示 UITabBarController。
编辑:我发现这段代码对于我需要显示父 UITabBarController 的代码来说很有用:
(void)webViewDidFinishLoad:(UIWebView *)webView { // 加载完毕,隐藏状态栏中的活动指示器 [UIApplication共享应用程序].networkActivityIndicatorVisible = NO;
// 仍在加载? 如果(网络.加载) 返回; (void )
I have a Tab Bar Controller-based app which has four views. I have a Splash screen I load in my AppDelegate which after a period of time shows the Tab Bar as follows:
// Show tab bar
[window addSubview:tabBarController.view];
What I would like to do is keep the Splash screen visible and in my first view that is loaded show the tabBarController only after my webViewDidFinishLoad delegate in FirstViewController.m is executed the first time.
Is there any way to do this? I am just learning how to do this and so far I seem to be having no luck with any of the code I have tried to achieve this. I still don't know how to hide and show the UITabBarController however.
EDIT: I found this code which is useful as a barrier for the code I need to show the parent UITabBarController:
(void)webViewDidFinishLoad:(UIWebView *)webView
{
// finished loading, hide the activity indicator in the status bar
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;// Still loading?
if (web.loading)
return;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Nib 创建启动屏幕的对象并将其添加到窗口
[window addSubView:obj];
[self PerformSelector:@selector(loadFirstViewOnDelay) withObject:nil afterDelay:0.5];
在 DidFinishLaunching
然后
-(void)loadFirstViewOnDelay
{
[窗口 addSubview:tabBarController.view];
}
Make a object of your splash screen by using Nib and add this on window
[window addSubView:obj];
[self performSelector:@selector(loadFirstViewOnDelay) withObject:nil afterDelay:0.5];
in DidFinishLaunching
then
-(void)loadFirstViewOnDelay
{
[window addSubview:tabBarController.view];
}