iphone - Getting a view to respond to a sibling's touch event / message -


I'm sure that's the right way to do this, I'm new to touching Objective-C and Coco so I Do not know what is there.

I have an application that has a (simplified) visual hierarchy

  window - button - button - vishwu - sub-subview  

What am I trying to do, is receiving a review to do something in response to a touch event on one of the buttons. I can come up with some ways of doing this, but I'm not sure which is the preferred method.

  • Add an outlet for the menu view controller (handle window) and store the reference of the subview. When I need to send a message to the subview, then I can just pass the message that I want (because I already have a reference). It seems a little bit ... delicate?

  • Add another action on the button (the first view is a method on the controller, the second one will be on the subview class) it looks problematic because it is important that the view controller is in the fire The action of the button earlier tries to handle the sub-message

  • Some types of representative systems?

  • Write a new view controller for the subview and that message passes the main view controller (not sure that the first controller is right for its In addition, the actual code needed for the subview is relatively small - a new controller looks like Overkill).

  • Something else is that I '

Some direction would be appreciated!

You say that there is an action on the view controller in the button (seeing the controller?). And you want to call action / method on the subview that happens after that action. Therefore, I will suggest my visual controller action after a notification of the incident, and the subclass can listen to that event. Alternatively, the view controller can have a connection with a subview.

It ensures the sequence of verbs - most observational techniques will not ensure that order.

Matt Gallagher has written a helpful article, looking at the techniques that can help you.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -