【问题标题】:How do I remove the gradient from UIToolbar in iPad?如何从 iPad 的 UIToolbar 中删除渐变?
【发布时间】:2013-03-22 07:20:54
【问题描述】:

我在 iPad App 中使用UIToolbar,如何去除其中的渐变背景?以下是我的代码。

aToolbar.barStyle = UIBarStyleBlackTranslucent;
aToolbar.tintColor = [UIColor blackColor]; toolbar.alpha = 1.0;

【问题讨论】:

    标签: ios ipad uitoolbar


    【解决方案1】:

    你需要在 UIToolbar 中设置图片,所以移除 Gradient。

    我的建议是请设置图像并创建自定义 UItoolbar。

    代码如下。

       UIImage *gradientImage44 = [[UIImage imageNamed:@"imageName.png"] 
                                    resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        // Set the background image for *all* UINavigationBars
        [[UIToolbar appearance] setBackgroundImage:gradientImage44 
                                           forBarMetrics:UIBarMetricsDefault];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-15
      • 2017-10-18
      • 2010-10-14
      • 2011-03-01
      • 2016-02-01
      • 2012-01-23
      • 1970-01-01
      相关资源
      最近更新 更多