如何在 iPhone 应用程序启动时显示第二个或第三个标签栏

发布于 2024-10-07 09:58:57 字数 127 浏览 0 评论 0原文

你好 我创建了一个 iPhone 应用程序。我正在使用 5 个选项卡栏项目。默认情况下,当应用程序启动时,它会显示第一个选项卡栏。我想要做的是在应用程序启动时显示第三个选项卡栏。 我怎样才能做到这一点?

此致, 阿卜杜勒盖维

hi
I've created an iphone app. I am using 5 tab bar items. By default, when app gets launched, it shows up first tabbar. What i want to do is to display 3rd tab bar when application is launched.
How can i do that?

Best regards,
Abdul qavi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

因为看清所以看轻 2024-10-14 09:58:57

在 AppDelegate 的 application didFinishLaunchingWithOptions 方法中,在结束前的某个时间,添加指定的行。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    . . . 

    // Add this line
    tabcontroller.selectedIndex = 2;

    [window addSubview:tabcontroller.view];
    [window makeKeyAndVisible];
    return YES;
}

请注意,2 是要切换到的选项卡,第一个选项卡从 0 开始。

In the application didFinishLaunchingWithOptions method of your AppDelegate, some time before the end, add the indicated line.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    . . . 

    // Add this line
    tabcontroller.selectedIndex = 2;

    [window addSubview:tabcontroller.view];
    [window makeKeyAndVisible];
    return YES;
}

Note that the 2 is the tab to switch to, starting with 0 for the first tab.

相守太难 2024-10-14 09:58:57

只需将选项卡栏的 selectedItem 属性设置为您想要显示的数字即可。

快乐编码....

just set the selectedItem property of the tabbar to the number you want to show up.

hAPPY iCODING....

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