由于某些原因,当我将背景图像应用于UIBarButtonItem时,它会使边角变成锐利的矩形。我如何使用UIAppearance修复这个问题?
// bar button
id barButtonAppearance = [UIBarButtonItem appearance];
[barButtonAppearance setBackgroundImage:[theme imageForBarButtonNormal] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
-(UIImage *) imageForBarButtonNormal
{
return [[UIImage imageNamed:@"bar_button_item_blue_background"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
}发布于 2013-03-06 01:11:35
您的图像需要有圆角。这与在iOS中在幕后完成界面元素的方式相同。
https://stackoverflow.com/questions/15229747
复制相似问题