Cocoa touch 按下时,停止按钮变为蓝色
在我的iPad应用程序中,我有一个UIButton,按下它会启动一些需要时间的数据传输。在此期间,按钮变为蓝色,如图所示: 有没有办法改变这种颜色?试试这个Cocoa touch 按下时,停止按钮变为蓝色,cocoa-touch,uibutton,Cocoa Touch,Uibutton,在我的iPad应用程序中,我有一个UIButton,按下它会启动一些需要时间的数据传输。在此期间,按钮变为蓝色,如图所示: 有没有办法改变这种颜色?试试这个 UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 50, 100, 50)]; [button setTitle:@"hi" forState:UIControlStateNormal]; [button setBackgroundColor
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];
更改色调颜色,当按钮高亮显示时将使用该颜色
[myButton setTintColor:[UIColor blackColor]];
您是否在主线程上执行此数据传输?你应该考虑在后台线程上做一些艰苦的工作,不要阻塞UI。