我想显示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];
}
答案 0 :(得分: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];
}];
}