美文网首页
后台进入前台发通知调用方法

后台进入前台发通知调用方法

作者: lifeLL | 来源:发表于2018-08-09 18:49 被阅读0次
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationBecomeActive) name:UIApplicationWillEnterForegroundNotification object:nil];
-(void)applicationBecomeActive{
    if (_scrollviewFlag.contentOffset.y == 0) {
        self.isHidenNaviBar = YES;
        _tableView.frame = CGRectMake(0, 0, SCREEN_W ,SCREEN_H);//推到后台再回来会异常,所以设置
        self.navigationController.navigationBar.alpha = 0;
        UIImage *colorImage = [[UIImage alloc]init];
        [self.navigationController.navigationBar setBackgroundImage:colorImage forBarMetrics:UIBarMetricsDefault];
        self.title = @"";
    }else{
        self.isHidenNaviBar = NO;
        _tableView.frame = CGRectMake(0, -64, SCREEN_W ,SCREEN_H);//推到后台再回来会异常,所以设置
        UIImage *colorImage = [UIImage imageWithColor:KWhiteColor];
        [self.navigationController.navigationBar setBackgroundImage:colorImage forBarMetrics:UIBarMetricsDefault];
    }
}

相关文章

网友评论

      本文标题:后台进入前台发通知调用方法

      本文链接:https://www.haomeiwen.com/subject/jsicbftx.html