这个导航栏的背景是这张图片的顶部一部分(导航栏和背景图应该是一张图片,不是分开显示), 我需要怎么设置? 而且让文字能更好的显示在图片上面?
认证0级讲师
思路 - 设置背景色为透明图片 - 设置导航栏下线条也为透明图片 - 设置状态栏
(望采纳) [[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent]; self.bgImageView.backgroundColor=[UIColor redColor];
UIImage *image = [UIImage imageNamed:@"bg.png"]; [self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:image];
UIView *statusview=[[UIView alloc]initWithFrame:CGRectMake(0, -20, 320, 20)]; statusview.backgroundColor=[UIColor redColor]; [self.navigationController.navigationBar addSubview:statusview];
思路
- 设置背景色为透明图片
- 设置导航栏下线条也为透明图片
- 设置状态栏
(望采纳)
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
self.bgImageView.backgroundColor=[UIColor redColor];
UIImage *image = [UIImage imageNamed:@"bg.png"];
[self.navigationController.navigationBar setBackgroundImage:image
forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:image];
UIView *statusview=[[UIView alloc]initWithFrame:CGRectMake(0, -20, 320, 20)];
statusview.backgroundColor=[UIColor redColor];
[self.navigationController.navigationBar addSubview:statusview];