ios - 如何在 SCLAlertView showWaiting 警报后重定向到主页?

标签 ios objective-c uibutton alert

我想显示一个 SCLAlertView 警报,几秒钟后,它将消失并重定向到其他 View Controller 。但是现在我所做的是点击“完成”按钮后,只能执行操作。任何想法?请帮忙。

这是我的代码:-

-(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];

}

最佳答案

您可以使用 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];
          }];

    }

关于ios - 如何在 SCLAlertView showWaiting 警报后重定向到主页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50206204/

相关文章:

IOS:关闭两个viewController

iphone - 以编程方式更改按钮的属性

ios - 使用带有 apikey 的 youtube v3

javascript - 本地 laravel API 上的 Nativescript-Vue axios 调用错误 [请求失败,状态码为空]

ios - SKTextureAtlas 和 3x 图像

objective-c - 可以将 "sticky" header 添加到分组 TableView 吗?

iphone - 触摸 subview 时如何取消滚动

ios - 当我从 View 回到标签栏 Controller 时,标签栏不显示

ios - 持续后台更新位置

ios - 如何在离线时使用 NSURLCache 返回缓存的 API 响应(iOS App)