Как перенаправить на домашнюю страницу после SCLAlertView showWaiting alert? - PullRequest
0 голосов
/ 07 мая 2018

Я хотел бы показать предупреждение SCLAlertView, и через несколько секунд оно исчезнет и перенаправится на другой viewcontroller. Но теперь я нажал кнопку «Готово», и теперь можно выполнить только действие. Любая идея? Пожалуйста, помогите.

Вот мой код: -

-(IBAction)submitButtonDidPressed:(id)sender {
 NSString *userName = [NSString stringWithFormat:@"Welcome back %@", txtUsername.text];

            SCLAlertView *alert = [[SCLAlertView alloc] init];
            [alert addButton:@"Done" target:self selector:@selector(clickLogin:)];
            alert.customViewColor = ThemeBlueColor;
            [alert showWaiting:self title:@"Welcome" subTitle:userName closeButtonTitle:nil duration:2.0f ];
}

-(void) clickLogin:(UIButton*)sender
{
    int index = 0;
    self.tabBarController.selectedIndex = index;
    [self.tabBarController.viewControllers[index] popToRootViewControllerAnimated:NO];

}

1 Ответ

0 голосов
/ 07 мая 2018

Вы можете использовать alertIsDismissed для вызова навигации следующим образом:

 -(IBAction)submitButtonDidPressed:(id)sender {
     NSString *userName = [NSString stringWithFormat:@"Welcome back %@", txtUsername.text];

       SCLAlertView *alert = [[SCLAlertView alloc] init];
         [alert addButton:@"Done" target:self selector:@selector(clickLogin:)];
         alert.customViewColor = ThemeBlueColor;
         [alert showWaiting:self title:@"Welcome" subTitle:userName 
         closeButtonTitle:nil duration:3.0f ];


         [alert alertIsDismissed:^{
                  [self clickLogin:nil];
          }];

    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...