【问题标题】:How to redirect to home page after SCLAlertView showWaiting alert?SCLAlertView showWaiting 警报后如何重定向到主页?
【发布时间】:2018-05-07 02:03:15
【问题描述】:

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

这是我的代码:-

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

}

【问题讨论】:

  • 查看dismissBlock 属性。

标签: ios objective-c uibutton alert


【解决方案1】:

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

    }

【讨论】:

  • 太好了,@Abdelahad,您的解决方案有效!非常感谢!
猜你喜欢
  • 1970-01-01
  • 2018-07-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-09
  • 2019-07-02
  • 1970-01-01
  • 2011-05-13
相关资源
最近更新 更多