我的storyboard中有一个选项卡栏,有5个选项卡。
我希望我的应用程序在中间的选项卡上加载,但我找不到如何做以及在哪里做。
我的storyboard中有一个选项卡栏,有5个选项卡。
我希望我的应用程序在中间的选项卡上加载,但我找不到如何做以及在哪里做。
我找到了答案!
在 appDelegate.m 文件中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UITabBarController *tabBar = (UITabBarController *)self.window.rootViewController;
tabBar.selectedIndex = 2;
return YES;
}
希望这能有所帮助!