gpt4 book ai didi

ios - 如何去ViewController?

转载 作者:行者123 更新时间:2023-12-03 01:54:41 25 4
gpt4 key购买 nike

我有TableViewControllerViewController。我想在下载音频后输入ViewController。但是我现在正在下载音频。我使用fileExists检查音频是否已下载。但这是行不通的。 ViewController下载音频后如何进入?

这是我的下载代码

if (!fileExists) {

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Download audio?" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction* actionAdd = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.frame = CGRectMake(0, 0, 24, 24);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryView = spinner;
[spinner startAnimating];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

NSString *stringURL = @"https://drive.google.com/uc?export=download&id=0B6zMam2kAK39R2Z5RlVWZkN3Vzg";
NSURL *url = [NSURL URLWithString:stringURL];
NSData *urlData = [NSData dataWithContentsOfURL:url];
[urlData writeToFile:filePath atomically:YES];

});
if (fileExists) {
[self performSegueWithIdentifier: @"detailSegue" sender: self];
}

}];
UIAlertAction* actionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {

}];

[alert addAction:actionAdd];
[alert addAction :actionCancel];

[self presentViewController:alert animated:YES completion:nil];
}
if (fileExists) {
[self performSegueWithIdentifier: @"detailSegue" sender: self];

}

}

最佳答案

// **尝试此操作,然后在Inspector中设置ViewController的标识符**

  ViewController *vc17 = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"];

[self presentViewController:vc17 animated:YES completion:nil];

关于ios - 如何去ViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36372769/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com