你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> iOS雙擊home鍵之後應用程序顯示一張圖片,保護應用程序隱私

iOS雙擊home鍵之後應用程序顯示一張圖片,保護應用程序隱私

編輯:關於IOS

類似於支付寶項目,在雙擊home鍵之後應用程序進入後台程序,然後這時候將應用程序頁面隱藏,然後顯示一樣默認圖片

 //   After didFinish addObserver  accept Notification
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(userDidTakeScreenshot) name:UIApplicationDidEnterBackgroundNotification object:nil];
- (void)userDidTakeScreenshot
{
    
    self.lockView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    UIImage *image = [UIImage imageNamed:@"Personal_logo.jpg"];
    self.lockView.image = image;
    [self.window addSubview:self.lockView];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
    
    //  進入前台移除視圖
    
    if (self.lockView)
    {
        [self.lockView removeFromSuperview];
        self.lockView = nil;
    }
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved