I ve set of images (created dynamically) which are placed in a single row in my UIScrolView.. I want to trace the changes in the locations (i.e I want to get the x,y position of all the images)while scrolling ….
Things I ve tried:
1.I stored all the images in an array
2.Then I printed the locations of images in this delegate
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
But I can’t get result what I want….Instead of that I get the positions of the images which I specified…..How can I get rid of this????
Thanks
I’m not entirely sure I understand what you mean by the location of the images but I think you want the
contentOffsetproperty ofUIScrollView. If you subtract thexandyvalues of that from the offset of the frames of your images then you will effectively get where the images are relative to yourUIScrollView‘s parent.Edit: Here’s some code to get you started:
That will get the origin of the images in the coordinate system of the
UIScrollView‘s bounds. If you want just the origin of the images within the coordinate system of theUIScrollView‘s contents then you just wantview.frame.originitself. But I don’t think that’s what you want since you said “But I can’t get result what I want….Instead of that I get the positions of the images which I specified”.