Open ETmanwenhan opened 6 years ago
我的导航栏默认是透明的此时屏幕的始点位置为(0,64),滚动列表到一定位置后需要改为黑色。发现当跳转界面,再回到当前界面时,屏幕的始点位置变为 (0,0)了。
(void)jk_setNavigationBarBackgroundColor:(UIColor )backgroundColor { UIImage image = JKGraphicsImageContextWithOptions(CGSizeMake(CGRectGetWidth(self.bounds), 64), ^{ [backgroundColor setFill]; UIRectFill(CGRectMake(0, 0, CGRectGetWidth(self.bounds), 64)); });
[self setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; if ([self jk_systemBarContentView].backgroundColor != [UIColor clearColor]) { [self setShadowImage:[UIImage new]]; [self jk_systemBarContentView].backgroundColor = [UIColor clearColor]; [self jk_navigationBar].backgroundColor = [UIColor clearColor]; } }
我的导航栏默认是透明的此时屏幕的始点位置为(0,64),滚动列表到一定位置后需要改为黑色。发现当跳转界面,再回到当前界面时,屏幕的始点位置变为 (0,0)了。
(void)jk_setNavigationBarBackgroundColor:(UIColor )backgroundColor { UIImage image = JKGraphicsImageContextWithOptions(CGSizeMake(CGRectGetWidth(self.bounds), 64), ^{ [backgroundColor setFill]; UIRectFill(CGRectMake(0, 0, CGRectGetWidth(self.bounds), 64)); });
[self setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; if ([self jk_systemBarContentView].backgroundColor != [UIColor clearColor]) { [self setShadowImage:[UIImage new]]; [self jk_systemBarContentView].backgroundColor = [UIColor clearColor]; [self jk_navigationBar].backgroundColor = [UIColor clearColor]; } }