2

i have some alert and that displaying with some delays.there have 2 button one is Cancel and Pause. When i Tap on the Pause button that alert should stay on the view for some time .when Tap on the cancel want to dismiss the alert , if no action happened want to automatically dismiss the alert. Am using this code

dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
                dispatch_after(popTime, dispatch_get_main_queue(), ^(void){

                    NSLog(@"%f",delayInSeconds);

                    UIAlertController* alertDisplay1AutoMatic = [UIAlertController alertControllerWithTitle:displayData.title
                                                                                                    message:displayData.content
                                                                                             preferredStyle:UIAlertControllerStyleAlert];


                    [self.window.rootViewController presentViewController:alertDisplay1AutoMatic animated:YES completion:nil];


                    UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel
                                                                         handler:^(UIAlertAction * action) {


                                                                                 [self.window.rootViewController dismissViewControllerAnimated:YES completion:nil];


                                                                         }];

                    self.PauseAction = [UIAlertAction actionWithTitle:@"Pause" style:UIAlertActionStyleDefault
                                                                        handler:^(UIAlertAction * action) {




                                                                        }];


                    [self performSelector:@selector(dismissUIAlertViewType:) withObject:alertDisplay1AutoMatic afterDelay:10];

                    [alertDisplay1AutoMatic addAction:cancelAction];
                    [alertDisplay1AutoMatic addAction: self.PauseAction];
                    alertDisplay1AutoMatic.actions[1].enabled = NO;

                });
Manju SSP
  • 63
  • 6

0 Answers0