//设置UIButton在点按住时附带高亮效果
_addMusicBtn.showsTouchWhenHighlighted = YES;
[_addMusicBtn addTarget:self action:@selector(addMusicAction:) forControlEvents:UIControlEventTouchUpInside];
//设置保持按钮的高亮状态(放在一个循环里面,强制按钮高亮)
- (IBAction)onTouchup:(UIButton *)sender {
[self performSelector:@selector(highlightButton:) withObject:sender afterDelay:0.0];
}
/*
- (void)addMusicAction:(id)sender
{
[self performSelector:@selector(highlightButton:) withObject:sender afterDelay:0.0];
}
*/
//设置按钮高亮
- (void)highlightButton:(UIButton *)btn {
[btn setHighlighted:YES];
}