IOS开发button点击之后有高亮效果,效果一直保留,点击下一个按钮高亮效果转移。
IOS开发button点击之后有高亮效果,效果一直保留,点击下一个按钮高亮效果转移。第一张图片默认高亮效果。我想在button下面加个image效果和高亮差不多,点击一个...
IOS开发button点击之后有高亮效果,效果一直保留,点击下一个按钮高亮效果转移。第一张图片默认高亮效果。我想在button下面加个image效果和高亮差不多,点击一个按钮image也跟着过去,不是背景,而是button底部那个。
- (void) initNewsGroup{
int _count = 3;
for (int i =0; i< _count; i++) {
UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
float x = 100*i;
[but setTag:i];
[but setFrame:CGRectMake(x+2,70.0f, 100.0f, 30.0f)];
NSString * titleName=nil;
switch (i) {
case 0:
titleName= @"产品";
break;
case 1:
titleName=@"演示";
break;
case 2:
titleName=@"介绍";
break;
default:
titleName=nil;
break;
}
[but setTitle:titleName forState:UIControlStateNormal];
but.titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
[but setTitleColor:SEPARATOR_COLOR_GLXG forState:UIControlStateHighlighted];
if (i == 0) {
[but setTitleColor:SEPARATOR_COLOR_GLXG forState:UIControlStateNormal];
}else if (i == 1){
[but setTitleColor:SEPARATOR_COLOR forState:UIControlStateNormal];
}else{
[but setTitleColor:SEPARATOR_COLOR forState:UIControlStateNormal];
}
一直实现不了,求大神帮忙修改下 展开
- (void) initNewsGroup{
int _count = 3;
for (int i =0; i< _count; i++) {
UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
float x = 100*i;
[but setTag:i];
[but setFrame:CGRectMake(x+2,70.0f, 100.0f, 30.0f)];
NSString * titleName=nil;
switch (i) {
case 0:
titleName= @"产品";
break;
case 1:
titleName=@"演示";
break;
case 2:
titleName=@"介绍";
break;
default:
titleName=nil;
break;
}
[but setTitle:titleName forState:UIControlStateNormal];
but.titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
[but setTitleColor:SEPARATOR_COLOR_GLXG forState:UIControlStateHighlighted];
if (i == 0) {
[but setTitleColor:SEPARATOR_COLOR_GLXG forState:UIControlStateNormal];
}else if (i == 1){
[but setTitleColor:SEPARATOR_COLOR forState:UIControlStateNormal];
}else{
[but setTitleColor:SEPARATOR_COLOR forState:UIControlStateNormal];
}
一直实现不了,求大神帮忙修改下 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询