setBackgroundImage forBarMetrics + scaleToFill?

时间:2011-11-13 14:19:59

标签: ios5 uinavigationbar uitoolbar

从iOS5开始,你应该通过setBackgroundImage forBarMetrics设置工具或导航栏的backgroundimage。

在iOS4中我使用:

@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end

在iOS4中,图像在iOS5中“缩放以填充”,如果图像很小,则重复该图像。当你使用setBackgroundImage forBarMetrics时,有没有办法将行为设置为“scaleToFill”?

THX!

0 个答案:

没有答案