我的应用程序中有很多按钮在按下时会突出显示,但是我已经添加了一些按钮,这些按钮在按下按钮时不会突出显示。
"突出显示调整图像"被选中,我也试过
quickYes.adjustsImageWhenHighlighted = YES
但是,当按下任何按钮时,这并不突出显示所选按钮。 任何人都可以建议为什么会发生这种情况? 这是我下面菜单的代码(我不确定这里的代码是否会影响它的突出显示?):
-(IBAction)OpenMenu:(id)sender {
if (draw1 ==0) {
draw1 = 1;
[UIButton beginAnimations:nil context:nil];
[UIButton setAnimationDuration:0.5];
[UIButton setAnimationDelay:0.0];
[UIButton setAnimationCurve:UIViewAnimationCurveEaseOut];
scrollView.frame = CGRectMake(0, 0, 1024, 120);
openMenu.frame = CGRectMake(708, 120, 265, 75);
oSmallLabel.frame = CGRectMake(20, 127, 60, 30);
quickYes.frame = CGRectMake(20, 10, 99, 96);
quickNo.frame = CGRectMake(148, 10, 99, 96);
quickHello.frame = CGRectMake(278, 10, 99, 96);
quickBye.frame = CGRectMake(409, 10, 99, 96);
quickThankYou.frame = CGRectMake(539, 10, 99, 96);
[openMenu setImage:[UIImage imageNamed:@"2.png"] forState:UIControlStateNormal];
[self.view bringSubviewToFront:scrollView];
[UIView commitAnimations];
} else {
draw1 = 0;
[UIButton beginAnimations:nil context:nil];
[UIButton setAnimationDuration:0.5];
[UIButton setAnimationDelay:0.0];
[UIButton setAnimationCurve:UIViewAnimationCurveEaseOut];
scrollView.frame = CGRectMake(0, -120, 1024, 120);
openMenu.frame = CGRectMake(708, 0, 265, 75);
oSmallLabel.frame = CGRectMake(20, 2, 60, 30);
quickYes.frame = CGRectMake(20, -99, 99, 96);
quickNo.frame = CGRectMake(148, -99, 99, 96);
quickHello.frame = CGRectMake(278, -99, 99, 96);
quickBye.frame = CGRectMake(409, -120, 99, 96);
quickThankYou.frame = CGRectMake(539, -99, 99, 96);
[openMenu setImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
[self.view bringSubviewToFront:scrollView];
[UIView commitAnimations];
}
}