问题
Currently, my iPad application implements multitasking. However, I would like to offer the user an option to disable multitasking. Is this possible, given the fact that you cannot modify the Info.plist dictionary where the UIApplicationExistsOnSuspend
key is set?
回答1:
Well, you could set a flag in your application delegate that would simply exit your app when the flag is TRUE within the delegate method applicationDidEnterBackground:
, like this:
@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
BOOL multitasking;
...
}
...
@end
@implementation MyAppDelegate
- (void) applicationDidEnterBackground:(UIApplication *)application {
if(!multitasking) {
exit(0);
return;
}
...
}
...
@end
来源:https://stackoverflow.com/questions/4282097/enabling-and-disabling-multitasking-within-application