- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我呈现模态视图,它是一个导航 Controller :
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:photoEditVC];
[self presentViewController:nvc animated:YES completion:NULL];
一旦我完成了模态视图,在 nvc 的可见 Controller 中:
[self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
结果
知道为什么会发生这种情况吗?
更新:我意识到这只会发生在关闭 View 之前,我更新共享单例类中的一个值,我用它来跟踪事件。
[[SAStatus current] setValue:@(ua_photoSubmitted) forKeyPath:@"actions.user"];
[self dismissViewControllerAnimated:YES completion:NULL];
但如果我这样做,效果很好:
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[[SAStatus current] setValue:@(ua_photoSubmitted) forKeyPath:@"actions.user"];
}];
或者我可以这样做,而且效果很好:
[self dismissViewControllerAnimated:YES completion:^{
[[SAStatus current] setValue:@(ua_photoSubmitted) forKeyPath:@"actions.user"];
}];
当时,没有其他类观察该变量,所以我不明白为什么它会影响模态视图。
最佳答案
不确定这是导致黑屏的原因,但呈现的 View Controller 应该在自身上调用 dismissViewController,而不是在呈现的 View Controller 上。
[self dismissViewControllerAnimated:YES completion:nil];
关于ios - dismissViewControllerAnimated 导致空屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16615941/
我的项目中有 Simple popOver Controller 。我可以使用带有以下代码的操作按钮将其关闭。 [[self presentingViewController] dismissView
我有以下代码将调用模态视图。我在呈现 View Controller 时工作正常,但当我关闭它时,它崩溃了 _surveySummaryTableViewController = [[UITableV
我有一种方法可以从我的 TableView 发送电子邮件。 所以其中一个单元格是“联系我们”单元格,每当它被点击时,我都会使用 MFMailComposeViewController 进入邮件 Vie
我正在使用 QuickDialog 推送登录表单。除了无法关闭 View Controller 外,一切正常。代码如下: - (void)onLogin:(QButtonElement *)butto
我在使用 dismissViewControllerAnimated 时遇到了一些问题,我无法让它执行特定的转换。 我有一个 View Controller (主页),我正在使用模式打开另一个 VC(
我正在开发一个 iPad 应用程序,该应用程序具有一个登录 Controller ,该登录 Controller 可以连接到一个 View Controller 中。登录 Controller 是这样
dismissViewController 不会一直调用它的完成处理程序。我正在展示第一个 View ,当我关闭它时,它会调用完成处理程序,我将在其中展示 2 个 View 。关闭第二个 View 时
我有一个 UIViewController A,此时我的内存为 104 Mb。在 A 中,我通常像这样打开 UIVIewController B: UIViewController *b = [[UI
我正在使用 SVWebViewController .当我在这里展示 View Controller 时 SVModalWebViewController *webViewController = [
我呈现模态视图,它是一个导航 Controller : UINavigationController *nvc = [[UINavigationController alloc] initWithR
我在 IOS6 上使用 Storyboard。我正在尝试返回到之前的 View Controller ,但它不起作用。 我在这里自定义了我的后退按钮。 UIButton *btnBack = [UIB
我试图用自定义动画调用 dismissViewControllerAnimated,但它似乎不起作用。 当我像这样呈现 View Controller 时: cameraUI = UI
我一直在尝试找出如何增加 dismissViewControllerAnimated(true, completion: nil) 的持续时间,但似乎无法在 Apples documentation
我正在使用 Storyboard实现一个 iOS 应用程序,其中一个按钮调用 dismissViewControllerAnimated 以从 View Controller B 返回到前一个 Vie
用户点击按钮调出带有键盘的 View Controller 。在这种情况下,键盘会随着 View Controller 向上滑动,所以看起来键盘是固定在 View Controller 中的。 完成后
我有一个方法 - (void) swipeRight { [self dismissViewControllerAnimated:YES completion:nil]; } 当用户向右滑动时,我用它
我尝试了一些没有真正起作用的东西(更多我想到的东西)。 当使用 [self dismissViewControllerAnimated:YES completion:nil]; 我需要它来运行我要返回
我已经从 apple 下载了 PageControl 示例代码。这是一个带有 UIPageControl 的项目。我对其进行了更改,以便 UIScrollView 具有不同的 View 。对于我想添加
所以....我有一个 View Controller ,当我按下一个按钮时,会出现另一个 View Controller : - (IBAction)searchButtonPressed:(id)s
这是我的应用程序设计。我有 mainController,它显示 secondViewController。现在,我想关闭 secondViewController,然后在 mainControlle
我是一名优秀的程序员,十分优秀!