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

2018-08-09  本文已影响0人  lifeLL
[[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];
    }
}
上一篇 下一篇

猜你喜欢

热点阅读