本文介绍了更改UIToolbar的背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改UIToolbar的背景图片?我能够为导航栏执行此操作,但不能使用UIToolbar。我不想改变tintColor。我想改变整个图像。
How can I change the background image of UIToolbar? I have been able to do this for navigation bar, but not UIToolbar. I do not want to change tintColor. I would like to change the whole image.
感谢您的帮助。
推荐答案
来自
覆盖drawRect函数并创建 UIToolbar的实现
诀窍:))
Overriding the drawRect function and creating an implementation of the UIToolbar
does the trick :)
@implementation UIToolbar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"nm010400.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
这篇关于更改UIToolbar的背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!