UINavigationBar change Tint color with animation

后端 未结 3 2038
梦毁少年i
梦毁少年i 2021-02-04 18:13

Is it possible to change the tint with animation for a smoother effect?

This doesn\'t work for me:

[UIView beginAnimations:nil context:nil];
[self.naviga         


        
3条回答
  •  一个人的身影
    2021-02-04 18:48

    We find the solution in another thread : Transition Color navBar

    The solution was animating the attribut barTinTColor. Here is the code :

     self.navigationController.navigationBar.barTintColor = [UIColor redColor];
     [UIView animateWithDuration:5.0f animations:^{
        self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
    } completion:^(BOOL finished) {
    }];
    

提交回复
热议问题