[英]custom NavigationBar with Image background
Need help on a Custom NavigationBar
for my application. 在我的应用程序的自定义
NavigationBar
上需要帮助。
BackgroundColor
UIDesign is as below UIDesign如下
UIImage *gradientImage44 = [UIImage imageNamed:@"actionbar_logobar"];
[[UINavigationBar appearance]setBackgroundColor:[UIColor colorWithRed:0.0/255.0 green:83.0/255.0 blue:160.0/255.0 alpha:1.0]];
[[UINavigationBar appearance]setBackgroundImage:gradientImage44 forBarMetrics:UIBarMetricsDefault];
Above code is repeating the background image, also background color is not visible. 上面的代码重复了背景图片,背景色也不可见。 The result is:
结果是:
Kindly guide me. 请指导我。 Thanks
谢谢
You need to use a resizable image: 您需要使用可调整大小的图像:
UIImage* img = [[UIImage imageNamed:@"actionbar_logobar"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 50, 0, 50)];
You will need to change the values to match the stretchable part of your image though... 但是,您将需要更改值以匹配图像的可拉伸部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.