UIAlertController 之间的转换
Transition between UIAlertControllers
我需要做的是呈现一个带有进度条的警报控制器。下载完成后,我需要成功转换到辅助警报控制器!消息和 "Ok" 按钮供用户退出此设置。我已经单独构建了警报并且它们自己运行良好(进度条有点工作...)但是使用此代码:
我希望当 progressBar 达到 100% 时,第一个警报控制器将被关闭,下一个警报将出现,但什么也没有发生这是我的代码:
-(void)settingUpToolsProgressPopUp {
UIAlertController* progressAlert = [UIAlertController alertControllerWithTitle:@"Setting up tools ..." message:@"This could take a few minutes. Make sure to keep your tools near your mobile device." preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:progressAlert animated:YES completion:^{
//Progress bar setup
UIProgressView *progressView;
progressView = [[UIProgressView alloc]initWithFrame:CGRectMake(8.0, 98.0, progressAlert.view.frame.size.width - 16, 100.0)];
[[progressView layer]setCornerRadius:50];
progressView.trackTintColor = [UIColor whiteColor];
progressView.progressTintColor = [UIColor blueColor];
progressNumerator = 1.0;
progressDenominator = 1.0;
currentProgress = (float)(progressNumerator/progressDenominator);
[progressView setProgress: currentProgress animated:YES];
[progressAlert.view addSubview:progressView];
if(currentProgress > 1.0){
[self settingUpToolsProgressPopUp];
} else if(currentProgress == 1.0){
[self dismissViewControllerAnimated:YES completion:nil];
[self successAlertPopUp];
}
}];
}
p.s。我知道这些值现在是硬编码的......但无论我使用任何值,转换都不会发生。我还没有访问更新值的权限,所以我现在不能使用其他值...但我希望如果我使用 100% 的值,那么转换无论如何都会发生?
任何人都可以指出我正确的方向吗?为什么此代码不适用于这些控制器之间的转换?
非常感谢!
您需要在 dismissViewControllerAnimated
的完成处理程序中调用 successAlertPopUp
方法:
[self dismissViewControllerAnimated:YES completion:^{
[self successAlertPopUp];
}];
我需要做的是呈现一个带有进度条的警报控制器。下载完成后,我需要成功转换到辅助警报控制器!消息和 "Ok" 按钮供用户退出此设置。我已经单独构建了警报并且它们自己运行良好(进度条有点工作...)但是使用此代码:
我希望当 progressBar 达到 100% 时,第一个警报控制器将被关闭,下一个警报将出现,但什么也没有发生这是我的代码:
-(void)settingUpToolsProgressPopUp {
UIAlertController* progressAlert = [UIAlertController alertControllerWithTitle:@"Setting up tools ..." message:@"This could take a few minutes. Make sure to keep your tools near your mobile device." preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:progressAlert animated:YES completion:^{
//Progress bar setup
UIProgressView *progressView;
progressView = [[UIProgressView alloc]initWithFrame:CGRectMake(8.0, 98.0, progressAlert.view.frame.size.width - 16, 100.0)];
[[progressView layer]setCornerRadius:50];
progressView.trackTintColor = [UIColor whiteColor];
progressView.progressTintColor = [UIColor blueColor];
progressNumerator = 1.0;
progressDenominator = 1.0;
currentProgress = (float)(progressNumerator/progressDenominator);
[progressView setProgress: currentProgress animated:YES];
[progressAlert.view addSubview:progressView];
if(currentProgress > 1.0){
[self settingUpToolsProgressPopUp];
} else if(currentProgress == 1.0){
[self dismissViewControllerAnimated:YES completion:nil];
[self successAlertPopUp];
}
}];
}
p.s。我知道这些值现在是硬编码的......但无论我使用任何值,转换都不会发生。我还没有访问更新值的权限,所以我现在不能使用其他值...但我希望如果我使用 100% 的值,那么转换无论如何都会发生?
任何人都可以指出我正确的方向吗?为什么此代码不适用于这些控制器之间的转换?
非常感谢!
您需要在 dismissViewControllerAnimated
的完成处理程序中调用 successAlertPopUp
方法:
[self dismissViewControllerAnimated:YES completion:^{
[self successAlertPopUp];
}];