更改UIToolbar的背景图片 [英] Change background image of UIToolbar

查看:240
本文介绍了更改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.

感谢您的帮助。

推荐答案

来自我可以给UIToolBar是我iPhone应用程序中的自定义背景?

覆盖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的背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆