0

因此,当我自定义按钮时,我会放置这样的背景图像:

- (void) styleUIButtons {
    UIImage *buttonNormalBg = [[UIImage imageNamed:@"button_normal" ] stretchableImageWithLeftCapWidth:0 topCapHeight:0];
    UIImage *buttonSelectedBgb = [[UIImage imageNamed:@"button_selected" ] stretchableImageWithLeftCapWidth:0 topCapHeight:0];

    id appereance = [UIButton appearance];

    [appereance setTintColor:self.mainNavigationBarTextColor];
    [appereance setBackgroundImage:buttonNormalBg forState:UIControlStateNormal];
    [appereance setBackgroundImage:buttonSelectedBgb forState:UIControlStateHighlighted];
}

但是表格的披露指标可怕地变成了一行。为什么会这样?我该如何避免呢?我是否错误地自定义了按钮?在此处输入图像描述

4

2 回答 2

0

stretchableImageWithLeftCapWidth:topCapHeight:弃用

改为使用resizableImageWithCapInsets:

于 2013-10-23T18:34:45.353 回答
0

我复制了您的代码,图像对我来说工作正常。我唯一需要添加的是一个框架。

tintColor 似乎仅在没有背景图像时才起作用。

于 2013-10-23T19:15:59.617 回答