iOS 打开关闭用户交互

上代码:



//主线程刷新ui
#define MAINQUEUEUPDATEUI(UPDATECODE) dispatch_async(dispatch_get_main_queue(), ^{UPDATECODE});

#pragma mark - 用户交互打开关闭

/**
 *  打开用户交互
 */
+ (void)openInteractionEvents{
    MAINQUEUEUPDATEUI({
        if ([[UIApplication sharedApplication] isIgnoringInteractionEvents])
            [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    })
}

/**
 *  关闭用户交互
 */
+ (void)closeInteractionEvents{
    MAINQUEUEUPDATEUI({
        if (![[UIApplication sharedApplication] isIgnoringInteractionEvents])
            [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
    })
}

你可能感兴趣的:(iOS常用函数,ios)