按钮外观点击版本

时间:2014-10-05 11:02:57

标签: ios uibutton

我希望我的按钮看起来像某种方式,而不是按钮的子类,我写了这个

[[UIButton appearanceWhenContainedIn:[EABaseViewController class], nil]setBackgroundImage:[UIImage imageNamed:@"gradient_border"] forState:UIControlStateNormal];
[[UIButton appearanceWhenContainedIn:[EABaseViewController class], nil]setBackgroundImage:[UIImage imageNamed:@"gradient_border_grey"] forState:UIControlStateHighlighted];
[[UIButton appearanceWhenContainedIn:[EABaseViewController class], nil]setBackgroundImage:[UIImage imageNamed:@"gradient_border_grey"] forState:UIControlStateSelected];
  [[UIButton appearanceWhenContainedIn:[EABaseViewController class], nil]setBackgroundImage:[UIImage imageNamed:@"gradient_border_grey"] forState:UIControlStateSelected|UIControlStateHighlighted];
[[UIButton appearanceWhenContainedIn:[EABaseViewController class], nil]setBackgroundImage:[UIImage imageNamed:@"grey_border_grey"] forState:UIControlStateDisabled];

问题是,当我单击按钮时,而不是更改为图像gradient_border_grey,而是更改其alpha。我找不到如何解决它?

我该如何解决?

1 个答案:

答案 0 :(得分:0)

我需要将按钮类型设置为自定义以解决问题