having trouble adding a view as a subview to multiple view - iphone dev
<p>I need to add a view to multiple views in app. 
I am running a function which loops through all the UIViews and add that view as subview.</p>

<p>I have done something like this: </p>

<pre><code>-(void) setViewForEachSegment: (UIView*)view {
    int i;
    for (i = 0; i &lt; [segments count]; i++) {
        [[segments objectAtIndex:i] addSubview: view]
    }
}
</code></pre>

<p>here segments is an array of <code>UIViews</code>.</p>

<p>Now, what is happening is that the subview is added only to the last segment.</p>

<p>Has anyone else faced the same problem? I have been working on it for many hours, but don't know how to fix it.</p>
