对于福克斯新闻应用程序,它看起来只是设置导航栏的色调颜色 . 至于福克斯新闻标志,它是's probably just an image view on the title view of the navigation bar. This code goes into a view controller' s viewDidLoad 方法:
[self.navigationController.navigationBar setTintColor:/* Custom color here */];
UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo"]];
[self.navigationItem setTitleView:logoView];
[logoView release];
@implementation UINavigationBar (UINavigationBarBackgroundImage)
- (void)drawRect:(CGRect)rect
{
[[UIImage imageNamed:@"navigation-bar"] drawInRect:rect];
// Optionally you can set the tintColor here to go with the background
}
@end
0
将图像添加到导航栏使用此代码
- (void)drawRect:(CGRect)rect {
UIColor *color = [UIColor blackColor]; //this use to set button color in FoxNew Site //button color
UIImage *img = [UIImage imageNamed: @"ImageName"];
[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.tintColor = color;
}
2 回答
对于福克斯新闻应用程序,它看起来只是设置导航栏的色调颜色 . 至于福克斯新闻标志,它是's probably just an image view on the title view of the navigation bar. This code goes into a view controller' s
viewDidLoad
方法:要自定义后退按钮,您需要将其放在上一个视图控制器的
viewDidLoad
方法中(即此按钮返回的方法):如果要为应用程序的导航栏使用完全自定义的背景图像,则需要创建自定义
UINavigationBar
类别并在其drawRect:
方法中绘制图像 . 像这样的东西:将图像添加到导航栏使用此代码
为UINavigationBar创建类别