Reputation: 408
This is something strange to me. In my tabbar based application, application is not starting with start of first view in a tab, but instead of where i quit application? How to make sure that my app always start from first view in my first tab?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
return YES;
}
Upvotes: 1
Views: 445
Reputation: 3043
As in comment i said to start the app every time from the home screen i use in appdelegate this try it out:
- (void)applicationWillResignActive:(UIApplication *)application
{
exit(1);
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
exit(1);
}
hope it helps
Upvotes: 0
Reputation: 8804
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
you have to take care of this method on appdelegate.m like
- (void)applicationDidBecomeActive:(UIApplication *)application {
[tabController setSelectedIndex:0];
}
[Updated] check "DarkDust"'s link for your requirement
Upvotes: 1
Reputation: 15813
Users will expect to come back to the app where they left it in general. Overriding this behaviour is probably not a good idea. You CAN add a key for UIApplicationExitsOnSuspend to your plist and set it to true which will force multi-tasking phones to relaunch your app from scratch each time, but you really need to consider if this is the correct thing to do. It almost certainly isn't!
Upvotes: 0
Reputation: 6165
In case your application is running in background, add the following code:
- (void)applicationWillEnterForeground:(UIApplication *)application {
tabBarController.selectedIndex = 0;
}
Upvotes: 3
Reputation: 4686
Are you sure you're exiting the app and not just 'minimizing' it to the background?
Double-press the 'home' button of the iPhone to see the apps that are running in the background.
Upvotes: 0