UINavigationBar背景设置什么的

UINavigationBar 设置背景

//第一种情况
1)设置颜色
 [[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];
2)不调用下面方法设置图片
 - (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics
3)成功设置颜色
//第二种情况
1)设置颜色
 [[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];
2)调用下面方法设置图片
 - (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics
3)设置颜色看不到,仅能看到设置的背景图片
//第三种情况
1)设置颜色
 [[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];
2)调用下面方法设置空图片的UIImage
 [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
3)设置颜色看不到,仅能看到一个透明背景的UINavigationBar
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容