使用adjustimageWhenHighlighted修复这个,但是然后我放宽了变暗的效果,我想保留.
有什么建议如何应付这个?
@R_@R_403_6939@_6120@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)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)