本文介绍了iOS:触摸Imageview时发生的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将图像视图的userInteractionEnabled属性设置为YES-这样它将接收触摸事件 向其中添加UITapGestureRecongnizer set image view's userInteractionEnabled property to YES - so it will receive touch events
add UITapGestureRecongnizer to it
我有一个带png的ImageView,我想这样做:当有人触摸此imageview时,其alpha更改为0.0,这可能吗?(全部不带按钮)
I have an ImageView with a png and I want to do this: when someone touch this imageview it's alpha change to 0.0, is it possible? (all without buttons)
推荐答案是的,有可能.例如,您可以按照以下步骤进行操作:
Yes, it is possible. For example you can do that with following steps:
在手势处理程序中将视图的Alpha设置为0.0,您也可以使用动画来做到这一点:
in gesture handler set view's alpha to 0.0, you can do that with animation as well: [UIView animateWithDuration:0.5 animations:^(void){ imageView.alpha = 0.0f; }];
更多推荐
iOS:触摸Imageview时发生的事件
发布评论