Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have never built a complete user interface using the UI toolkit, so I don't have much experience with it. Here is what I think should work though.</p> <p>Every UIView, and this the UIWindow, has a property <code>subviews</code>, which is an NSArray containing all the subviews.</p> <p>The first subview you add to a view will receive index 0, and the next index 1 and so forth. You can also replace <code>addSubview:</code> with <code>insertSubview: atIndex:</code> or <code>insertSubview:aboveSubview:</code> and such methods that can determine the position of your subview in the hierarchy.</p> <p>So check your code to see which view you add first to your UIWindow. That will be 0, the other will be 1.<br> Now, from one of your subviews, to reach another you would do the following:</p> <pre><code>UIView * theOtherView = [[[self superview] subviews] objectAtIndex: 0]; // or using the properties syntax UIView * theOtherView = [self.superview.subviews objectAtIndex:0]; </code></pre> <p>Let me know if that works for your case!</p> <hr> <p>(below this marker is my previous answer):</p> <p>If views need to communicate with each other, they should do so via a controller (that is, using the popular <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" rel="nofollow noreferrer">MVC</a> model).</p> <p>When you create a new view, you can make sure it registers itself with a controller.</p> <p>So the technique is to make sure your views register with a controller (which can store them by name or whatever you prefer in a Dictionary or Array). Either you can have the controller send a message for you, or you can get a reference to the view and communicate with it directly.</p> <p>If your view doesn't have a link back the controller (which may be the case) then you can make use of <a href="https://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like">singletons</a> and/or class methods to get a reference to your controller.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload