Glow 技术团队博客
  • Home
Sign in Subscribe

uinavigationbar

A collection of 1 post
ios

动态修改UINavigationBar的背景色

这是我们最终想要得到的效果: 思路 在UISrollView的delegate方法 - (void)scrollViewDidScroll:(UIScrollView *)scrollView中根据当前的contentOffset更新navigationBar的backgroundColor即可,so easy~ 开动 那么我们来看看apple为我们提供了哪些API来设置navigationBar的颜色。 首先想到的是最常用的[UINavigationBar appearance] ,我们一般会在AppDelegate中使用它对navigationBar进行统一的设置。但是如果试一下,会发现在scrollViewDidScrollView中调用它并不能动态地改变navigationBar的颜色,原因可以看一下Apple的doc: Use the UIAppearance protocol to get the appearance proxy for a class. You can customize the appearance of inst
  • leo
    leo
leo 7 Apr 2015 • 3 min read
Page 1 of 1
Glow 技术团队博客 © 2025
Powered by Ghost