大佬教程收集整理的这篇文章主要介绍了ios – 单击选定UIButton时未显示UIButton突出显示状态,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
基本上在突出显示的状态下,我将* .png图像应用为我的UIButton BACkgroundImage以产生按下效果.
但是如果按钮已经处于选中状态当我再次点击它时,我只是看不到突出显示的状态,但它直接进入正常状态!
观看问题 – > Video of the Issue!
请帮忙
//0 init UIButton UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x,y,aSide,aSidE)]; //1 Give it a BACkgroundColor [button setBACkgroundColor:aColor]; [..] //2 Set titleLabel and its style [button settitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [button settitleColor:[UIColor redColor] forState:UIControlStateSELEcted]; [button settitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; UIImage *shadowImage = [UIImage imagenamed:kBtnShadow]; shadowImage = [shadowImage stretchableImageWithLeftCapWidth:floorf(shadowImage.size.width/2) topCapHeight:floorf(shadowImage.size.height/2)]; [button setBACkgroundImage:shadowImage forState: UIControlStateHighlighted]; [button settitle:aLabel forState: UIControlStateNormal]; //3 Assign tag and Action [button setTag:tag]; [button addTarget:target action:a forControlEvents:UIControlEventTouchUpInside];
以上是大佬教程为你收集整理的ios – 单击选定UIButton时未显示UIButton突出显示状态全部内容,希望文章能够帮你解决ios – 单击选定UIButton时未显示UIButton突出显示状态所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。