Dragging an image from a scrollview
This is driving me bonkers, have been on it ages and still can get the thing to do what I want!
My view is set out like this:
RootViewController contains (UIView)flipView
FlipView contains (UiView)firstView
FirstView contains a scrollview and a load of imageviews
Scrollview contains a series of custom imageViews
I can drag the custom imageViews left and right and whichever one I drag it appears above all other custom imageViews in the scrollview because of this line in the cus开发者_如何学Ctom UIImageViews touchesBegan method:
[[self superview] bringSubviewToFront:self];
Great! But.....
Although I can drag vertically and the custom imageView leaves the bounds of the scrollview as required I cannot get it to appear above any of the imageviews that are on firstview?
I also have found that if I display the point.y value when I first touch the imageview to be dragged it shows 24 as I start to drag up to take it off the scrollview it goes to 26 and then stays at that value even though I can drag it all the way to the top of the screen, behind all the other imageviews?
I have obviously missed the bleeding obvious....obviously....help please?
Thanks
bringSubviewToFront: will only work within that view, i.e. your scrollview needs to be in front of all those other imageViews, or they will cover your scrollview. If you want to remove the image from the scrollview, it might be worth removing it and adding it on top of everything directly to your firstView while dragging.
精彩评论