简体   繁体   中英

Cancel current touches in an app

I am trying to cancel all current touches in a window/inside the entire app. I tried setting

window.userInteractionEnabled = NO;
window.userInteractionEnabled = YES;

But the touches that are active at the moment when I disable the user interaction are not cancelled. I also tried setting alpha to 0 and back to 1 and also setting hidden to YES and NO with no luck.

This:

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

also didn't work.

Try something like this:

[[yourSuperView subviews]
   makeObjectsPerformSelector:@selector(setUserInteractionEnabled:)
   withObject:[NSNumber numberWithBool:FALSE]];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM