【发布时间】:2013-03-22 07:20:54
【问题描述】:
我在 iPad App 中使用UIToolbar,如何去除其中的渐变背景?以下是我的代码。
aToolbar.barStyle = UIBarStyleBlackTranslucent;
aToolbar.tintColor = [UIColor blackColor]; toolbar.alpha = 1.0;
【问题讨论】:
我在 iPad App 中使用UIToolbar,如何去除其中的渐变背景?以下是我的代码。
aToolbar.barStyle = UIBarStyleBlackTranslucent;
aToolbar.tintColor = [UIColor blackColor]; toolbar.alpha = 1.0;
【问题讨论】:
你需要在 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];
【讨论】: