大佬教程收集整理的这篇文章主要介绍了UIButton忽略内容模式突出显示(adjustImageWhenHighlighted),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
使用adjustImageWhenHighlighted修复这个,但是然后我放宽了变暗的效果,我想保留.
有什么建议如何应付这个?
UIButton *imageBtn = [UIButton ... imageBtn.adjustsImageWhenHighlighted = NO; [imageBtn addTarget:self action:@SELEctor(doSomething:) forControlEvents:UIControlEventTouchUpInside]; [imageBtn addTarget:self action:@SELEctor(doHighlighted:) forControlEvents:UIControlEventTouchDown]; [imageBtn addTarget:self action:@SELEctor(doHighlighted:) forControlEvents:UIControlEventTouchDragEnter]; [imageBtn addTarget:self action:@SELEctor(doCancelHighlighted:) forControlEvents:UIControlEventTouchDragExit]; -(void)doSomething:(UIButton *)button{ ... [self performSELEctor:@SELEctor(doCancelHighlighted:) withObject:button afterDelay:0.2f]; } -(void)doHighlighted:(UIButton *)button{ UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5,5,300,300)]; imageView.BACkgroundColor = [UIColor blackColor]; imageView.alpha = 0.7; imageView.tag = 1000; [button addSubview:imageView]; } -(void)doCancelHighlighted:(UIButton *)button{ UIView *view = [button subviewWithTag:1000]; [UIView animateWithDuration:0.2f animations:^{ view.alpha = 0; } completion:^(BOOL finished) { [view removeFromSuperview]; }]; }
以上是大佬教程为你收集整理的UIButton忽略内容模式突出显示(adjustImageWhenHighlighted)全部内容,希望文章能够帮你解决UIButton忽略内容模式突出显示(adjustImageWhenHighlighted)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。