0

我正在使用setBackgroundImage:forState:来为各种状态的背景图像着色:

[myButton setBackgroundImage:genericImage forStates:UIControlStateNormal];
[myButton setBackgroundImage:buttonBackgroundPressed  
                   forStates:UIControlStateHighlighted];

是否有动画/应用淡入/淡出持续时间转换直接到此方法的方法?

4

1 回答 1

2

这个对我有用:

-(void) init{
  [myButton addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)touchUp:(id)sender
{
  UIButton* btn = sender;
  [UIView animateWithDuration:1.0 animations:^{
    btn.alpha = 0.5;
  }];
}
于 2014-02-07T20:56:41.890 回答