c# - UIImageView change UIImage on touch then restore previous UIImage -


so, after finding anwser in previos question here add gesturerecognizer on uiimageview. when user tap, color change. , when tap again default image restored.

any tip that?

i thinking list update in each click not sure best thing that.

here gesturerecognizer

uitapgesturerecognizer createtouchgesture(uiimageview imageview) {     var touchgesture = new uitapgesturerecognizer((tg) =>     {         imageview.image = drawselectedborder(imageview.image);     });          return touchgesture; } 

based on comments, can offer solution. use uiimageview animationimages property store base image. , when press again image retrieve array. , know in state are, use ighlighted property.

like :

var touchgesture = new uitapgesturerecognizer((tg) => {     if(!imageview.highlighted){         imageview.highlighted = true;         imageview.animationimages = new uiimage[]{imageview.image};         imageview.image = drawselectedborder(imageview.image);     }else{         imageview.highlighted = false;         imageview.image = imageview.animationimages[0];         system.diagnostics.debug.writeline(imageview.accessibilitylabel);     } }); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -