On Jul 30, 2012, at 11:20 AM, Dave <d...@looktowindward.com> wrote:

> I'm trying to add an a View at the start of a Scroll View but it always seem 
> to add to the end, not the start. The code I have is:
> 
> [theScroll insertSubview:myImageView atIndex:0];
> 
> In order to have the image added at the start of the Scroll View, but it acts 
> exactly the same as if I'd have done:
> 
> [theScroll addSubView:myImageView];
> 
> Any ideas?


You are going to have to define what you mean by start & end, as it is not 
clear in context.

If you mean a visual location, then neither of these methods are going to do 
what you want. You would put something visually at the start/end of the view by 
setting its location (via frame.origin or center) not via the add subview 
method you use.

If you mean a layering order, then the insertSubview:atIndex: method may 
attempt to do what you want, but given that a scroll view has other implicit 
subviews you would need to be more careful if you need an exact location. It 
may make more sense to use an intermediate subview that you place content into 
and which is a child of the scroll view in that case.
--
David Duncan


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to