如何在iOS中关闭ViewController?

只是

我创建了一个库,如果主应用程序调用我的库显示它,然后从服务器下载一些数据。但是,如果服务器出现一些错误,我想终止库视图,但是它不起作用,则主机应用程序中有一个委托:

-(void)libraryResult:(NSString*)result{
NSLog(@"result: %@", result);
}

然后,我使用viewWillAppear方法从服务器下载数据,并且下载具有如下委托方法:

-(void)networkManagerError:(NSString *)error{
[hud hide:YES];
[self.presentedViewController dismissViewControllerAnimated:YES completion:nil];
[self.delegate libraryResult:error];
}

我在日志中看到该应用程序返回到主应用程序,但是视图没有改变。如何解决呢?我的代码有什么问题?

穆克什

更改此行

[self.presentedViewController dismissViewControllerAnimated:YES completion:nil];

[self dismissViewControllerAnimated:YES completion:nil];

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何使用Swift在iOS中关闭ViewController

如何在Swift中关闭ViewController?

如何在iOS中关闭Popover视图

关闭ViewController#2后,如何在ViewController#1中重新加载Data()?

如何在iOS的子ViewController中检测触摸事件

如何从UIPageViewController的子ViewController中关闭键盘

如何从添加到视图的工具栏中关闭IOS ViewController

如何在iOS的SQLite中关闭数据库?

如何在移动android / iOs中关闭Webview(本地应用)

如何在iOS中打开和关闭通知?

如何在iOS 8中关闭两个UIViewController?

如何在iOS中不关闭返回键上的键盘

如何在iOS中关闭RNBlurModalView时捕获事件

如何在Navigationcontroller中从下到上显示/关闭ViewController?

如何打开新的 ViewController 关闭启动它的 iOS Swift

在ios13中关闭多个ViewControllers返回根ViewController

在使用Swift关闭ViewController的过程中,如何将值从ViewController B传递给ViewController A?

如何在iOS项目的viewController中向flutterViewController添加边距/填充

如何在 Xamarin.iOS 中為 ViewController 創建類?

如何在不关闭模态的情况下关闭从modalViewController推送的viewController?

如何关闭多个ViewController而不是初始ViewController

如何在UITabBarController中显示ViewController?

如何在ViewController中添加简单的按钮?

如何在Viewer中添加ViewController?

如何在共享扩展中呈现ViewController?

如何在代码中打开ViewController

如何在appdelegate中调用viewController的方法

如何在viewController中扩展调用函数

如何在ViewController中显示弹出窗口