nicklockwood / SwipeView

SwipeView is a class designed to simplify the implementation of horizontal, paged scrolling views on iOS. It is based on a UIScrollView, but adds convenient functionality such as a UITableView-style dataSource/delegate interface for loading views dynamically, and efficient view loading, unloading and recycling.
Other
2.65k stars 413 forks source link

Infinite loop when rubberbanding nested zoomed UIScrollViews #120

Open n00neimp0rtant opened 10 years ago

n00neimp0rtant commented 10 years ago

Here's where it keeps getting looped: image

So here's my setup: I need a horizontal swipe view with images as each item in the swipe view, but each image should be zoomable on it's own. I take a UIImageView, place it into a UIScrollView, make the scroll view zoomable by setting the scale properties and delegate, then place the scroll view as an item in the swipe view. I can swipe through them and zoom as expected. If I zoom in then use a single finger to swipe across the image, my own scroll view grabs the touch event and allows me to pan around the image (this is expected/desired behavior!), but if I reach the edge of the image where it should start rubberbanding, the app instantly locks up and Xcode informs me of that infinite loop.

It should be noted that my scroll view (the zoomable, pannable one that is acting as an item for the swipe view) is a UIScrollView subclass that has its delegate set to itself. Not sure if this has anything to do with the issue, but I figured it was worth mentioning.

asm09fsu commented 10 years ago

I have the same setup, and same crashing.

asm09fsu commented 9 years ago

I found out what the issue is with this. You can reproduce this by zooming into the image, rotating the device, and then panning the image. What you need to do is on autorotateDidFinish, zoom the image out.

ashchan commented 8 years ago

Placing a UIScrollView into SwipeView directly would cause this problem. To solve the issue, use a normal UIView and add the scroll view to that view. This way SwipView's scroll event won't mess up with your own scroll view's.