【问题标题】:custom NavigationBar with Image background带有图像背景的自定义 NavigationBar
【发布时间】:2015-01-11 17:08:26
【问题描述】:

在我的应用程序的自定义 NavigationBar 方面需要帮助。

  1. 排序大于屏幕宽度的图像。
  2. BackgroundColor

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];

上面的代码重复了背景图片,背景颜色也不可见。 结果是:

请指导我。谢谢

【问题讨论】:

  • 添加你正在使用的资产

标签: ios objective-c ios7 ios8 uinavigationbar


【解决方案1】:

您需要使用可调整大小的图片:

UIImage* img = [[UIImage imageNamed:@"actionbar_logobar"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 50, 0, 50)];

您需要更改这些值以匹配图像的可拉伸部分...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-13
    相关资源
    最近更新 更多