[英]Access the controller of parentviewcontroller from childviewcontroller
I am having code in which I have added one childviewcontroller using addsubview. 我正在使用addsubview在其中添加一个childviewcontroller的代码。 Example: 例:
Chidviewcontroller *child=[Chidviewcontroller alloc]intwithnibname:child....];
[parentviewcontroller.view addsubview:child.view];
Now the problem is that when I am working in childviewcontroller: it is not allowed to access any of the parentviewcontroller's object in childviewcontroller Even not allowed to import the Parentviewcontrollerr.h file it showed an error: -UnknownTypeName
现在的问题是,当我在childviewcontroller中工作时:不允许访问childviewcontroller中的任何parentviewcontroller对象,甚至不允许导入Parentviewcontrollerr.h文件,它也会显示错误: -UnknownTypeName
I have read this links . 我已阅读此链接 。
But it is still not allowed me to import and make the object of parentviewcontroller Please help me how to resolve this and do this 但是仍然不允许我导入并制作parentviewcontroller的对象,请帮助我如何解决此问题并执行此操作
这可能有助于看一看 ,不同之处在于,这里导航到childview,而您又添加了child
u need to navigate to the child class instead of adding it as a subview. 您需要导航到子类,而不是将其添加为子视图。 still if u want to use it as a subview, u need to use delegates to call the methods of the parent class. 还有,如果您想将其用作子视图,则需要使用委托来调用父类的方法。 Let me know if u understood my point of view 让我知道你是否理解我的观点
hope it helps. 希望能帮助到你。 happy coding :) 快乐的编码:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.