1.上代码
//主线程刷新ui
#define MAINQUEUEUPDATEUI(UPDATECODE) dispatch_async(dispatch_get_main_queue(), ^{UPDATECODE});
#pragma mark - 用户交互打开关闭
/**
* 打开用户交互
*/
+ (void)openInteractionEvents;
/**
* 关闭用户交互
*/
+ (void)closeInteractionEvents;
#pragma mark - 用户交互打开关闭
/**
* 打开用户交互
*/
+ (void)openInteractionEvents{
MAINQUEUEUPDATEUI({
if ([[UIApplication sharedApplication] isIgnoringInteractionEvents])
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
})
}
/**
* 关闭用户交互
*/
+ (void)closeInteractionEvents{
MAINQUEUEUPDATEUI({
if (![[UIApplication sharedApplication] isIgnoringInteractionEvents])
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
})
}