码迷,mamicode.com
首页 > 移动开发 > 详细

iOS双击home键之后应用程序显示一张图片,保护应用程序隐私

时间:2015-02-02 18:15:17      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:

源代码下载地址:http://download.csdn.net/detail/haogaoming123/8417041


类似于支付宝项目,在双击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.
}


iOS双击home键之后应用程序显示一张图片,保护应用程序隐私

标签:

原文地址:http://blog.csdn.net/haogaoming123/article/details/43409621

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!