how to call object from one class to another class [closed]
开发者_如何学JAVA
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this questionhi i am new to iphone. what i did is creating two classes named view1 view2. And i create a button in view1. now what i need is when ever i click the button in view one it goes to viewdidload in view2 how can i done this pls post some code or link. thank u
You're violating principals of MVC. Views should never talk directly to one another. If you need to signal some change in one view upon some event from another view, you need to route it through your controller.
I.e., a push of a button might change a label. In this case, the button receives an event (touches up or whatever) which get routed through its delegate (some controller). This delegate can then signal some action which then changes the text of the label (the second view).
I strongly suggest you become acquainted with the model-view-controller paradigm. It will give you insight into how the frameworks are constructed, and enable you to better write code targeting these frameworks.
精彩评论