按下时,停止UIButton变蓝

时间:2013-09-04 10:40:52

标签: cocoa-touch uibutton

在我的iPad应用程序中,我有一个UIButton,当按下时会启动一些需要时间的数据传输。在此期间,按钮变为蓝色,如图所示:

enter image description here

有没有改变这种颜色?

2 个答案:

答案 0 :(得分:3)

更改色调颜色,当按钮突出显示时将使用它。

[myButton setTintColor:[UIColor blackColor]];

答案 1 :(得分:0)

试试这个

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 50, 100, 50)];
    [button setTitle:@"hi" forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor blackColor]];
    [self.view addSubview:button];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:5.0];
    button.backgroundColor = [UIColor whiteColor];
    [UIView commitAnimations];
相关问题