如何隐藏 UITabBarController 直到第一次调用第一个视图上的 webViewdidFinishLoad

发布于 2024-10-08 18:02:23 字数 617 浏览 1 评论 0原文

我有一个基于选项卡栏控制器的应用程序,它有四个视图。我在 AppDelegate 中加载了一个启动屏幕,在一段时间后显示选项卡栏,如下所示:

// Show tab bar [窗口addSubview:tabBarController.view];

我想做的是保持启动屏幕可见,并且仅在第一次执行 FirstViewController.m 中的 webViewDidFinishLoad 委托后,在加载的第一个视图中显示 tabBarController 。

有什么办法可以做到这一点吗?我刚刚学习如何做到这一点,到目前为止,我似乎对我尝试实现这一目标的任何代码都没有运气。但是我仍然不知道如何隐藏和显示 UITabBarController。

编辑:我发现这段代码对于我需要显示父 UITabBarController 的代码来说很有用:

  • (void)webViewDidFinishLoad:(UIWebView *)webView { // 加载完毕,隐藏状态栏中的活动指示器 [UIApplication共享应用程序].networkActivityIndi​​catorVisible = 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

舂唻埖巳落 2024-10-15 18:02:23

使用 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];
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文