Saturday, May 25, 2013

UIApplication isIgnoringInteractionEvents example in objective c (iOS)


UIApplication isIgnoringInteractionEvents 

Returns whether the receiver is ignoring events initiated by touches on the screen.
- (BOOL)isIgnoringInteractionEvents
Return Value
YES if the receiver is ignoring interaction events; otherwise NO. The method returnsYES if the nested beginIgnoringInteractionEvents andendIgnoringInteractionEvents calls are at least one level deep.
UIApplication isIgnoringInteractionEvents example.
if ([[UIApplication sharedApplication] isIgnoringInteractionEvents])...
UIApplication isIgnoringInteractionEvents example.
//Check if the app is ignoring interatctions, if so, add a delay for 1 sec
if([[UIApplication sharedApplication] isIgnoringInteractionEvents]==TRUE) {
        [currentViewController performSelector:@selector(presentModalViewController:animated:) withObject:screen afterDelay:1];
    } else {
        [currentViewController presentModalViewController:screen animated:YES];
    }
UIApplication isIgnoringInteractionEvents example.
if (!self.setupComplete) {
    NSManagedObjectContext *moc = [self managedObjectContext];
    if (moc) {
        self.setupComplete = YES;
        [self setupWithManagedObjectContext:moc];
        UIApplication *app = [UIApplication sharedApplication];
        if ([app isIgnoringInteractionEvents]) [app endIgnoringInteractionEvents];
    } else [self presentErrorWithTitle:@"There was an error opening the database."];
}