警告:-不鼓励在分离的视图控制器上展示视图控制器 [英] Warning :-Presenting view controllers on detached view controllers is discouraged

查看:30
本文介绍了警告:-不鼓励在分离的视图控制器上展示视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我使用了导航控制器.稍后在某些视图中,我使用 presentViewController 来显示缩放图像.另外我没有使用故事板或笔尖.

In my app, I am using a navigation controller. Later on in some view I am using presentViewController for showing a zoomed image. Also I am not using a Storyboard or nib.

我仅在 iOS 7 中遇到此错误.它在 iOS 6 及更早版本中运行良好:

I am getting this error in iOS 7 only. It works fine in iOS 6 and earlier:

在分离的视图控制器上呈现视图控制器是气馁

Presenting view controllers on detached view controllers is discouraged

推荐答案

解决方案之一是如果您有 childviewcontroller 所以您只需通过给定的方式在其父级上呈现viewcontroller

One of the solution to this is if you have childviewcontroller So you simply presentviewcontroller on its parent by given

[self.parentViewController presentViewController:viewController animated:YES completion:nil];

对于dismiss,使用相同的dismissview 控制器.

And for dismiss use the same dismissview controller.

[self dismissViewControllerAnimated:YES completion:nil];

这对我来说是完美的解决方案.

This is perfect solution works for me.

这篇关于警告:-不鼓励在分离的视图控制器上展示视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆