几秒钟后出现 UINavigationItem
UINavigationItem appearing after a few seconds
我创建了一个具有菜单结构的应用程序,并希望在初始化第一个 ViewController 之前进行下载ViewController。
因此我在下载中编码ViewController:
NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:downloadUrl completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Doing download stuff ... (still working)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"firstViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:YES completion:nil];
}];
[downloadTask resume];
第一个ViewController出现了,所有的功能都还在。但是 UINavigationBar 中的菜单图标在几秒钟后首次显示。谁能帮帮我?
截图:View出现后的NavigationBar:
在等待将近 20 秒后:
这不是答案,只是建议
我写这里是为了正确格式化评论,尝试更改这里:
NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:downloadUrl completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Doing download stuff ... (still working)
dispatch_async(dispatch_get_main_queue()) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"firstViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:YES completion:nil];
}
}];
[downloadTask resume];
我创建了一个具有菜单结构的应用程序,并希望在初始化第一个 ViewController 之前进行下载ViewController。
因此我在下载中编码ViewController:
NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:downloadUrl completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Doing download stuff ... (still working)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"firstViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:YES completion:nil];
}];
[downloadTask resume];
第一个ViewController出现了,所有的功能都还在。但是 UINavigationBar 中的菜单图标在几秒钟后首次显示。谁能帮帮我?
截图:View出现后的NavigationBar:
这不是答案,只是建议
我写这里是为了正确格式化评论,尝试更改这里:
NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:downloadUrl completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//Doing download stuff ... (still working)
dispatch_async(dispatch_get_main_queue()) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"firstViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:YES completion:nil];
}
}];
[downloadTask resume];