How do I set up a proxy object in the main application NIB?

非 Y 不嫁゛ 提交于 2020-01-17 03:27:05

问题


I would like to set up a proxy object in the application NIB file. The problem is that the NIB file is the main application NIB that gets loaded automatically by the application and therefore I cannot set up the UINibProxiedObjectsKey dictionary as described in the documentation. Is there a way to set up a proxy object in the main application NIB? Or can I tap into the code that loads the main application NIB?


回答1:


My main problem was that I was trying to use Interface Builder as a dependency injection tool for the whole application. I had an instance of an object that had to be created in code and then I needed to pass this instance to other objects in the NIB, therefore the need for proxy objects. In the end I found the proxy object stuff to be overkill. I created a separate class that takes care of wiring my objects together and the problem disappeared.



来源:https://stackoverflow.com/questions/2135039/how-do-i-set-up-a-proxy-object-in-the-main-application-nib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!