Force iphone app to restart programmatically?

前端 未结 7 971
北荒
北荒 2020-11-27 03:28

I am trying to get my iPhone app to restart programmatically when the Logout button is pressed.

Has anyone got a code sample to share? I\'ve read that it is possible

7条回答
  •  感情败类
    2020-11-27 03:48

    Put this in a UIAlertAction asking the user "Save and Quit". It will animate the exit(0) so at least it looks planned.

    - (void)saveAndQuit
    {
        [UIView animateWithDuration:0.8 animations:^{
            self.window.alpha = 0.0; // fade out...
            // ... while pinching to a point
            self.window.transform = CGAffineTransformScale(
                    CGAffineTransformMakeTranslation( 0, 0 ), 0.1, 0.1 );
        } completion:^(BOOL finished) {
            exit(0);
        }];
    }
    

提交回复
热议问题