保持按钮的高亮状态

//设置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]; }

 

posted @ 2014-08-04 10:50  2014_4_30  阅读(305)  评论(0编辑  收藏  举报