AsyncDisplayKit icon indicating copy to clipboard operation
AsyncDisplayKit copied to clipboard

[ASScrollNode] Is it possible to zoom/pan with an ASVideoNode or ASNetworkImageNode inside an ASScrollNode?

Open lukeivers opened this issue 10 years ago • 6 comments

ASDK v 1.9.90

Hi!

I am using ASPagerNode to do a full screen swipe-able interaction model. Within each ASCellNode, I have an ASVideoNode that is a child of an ASScrollNode. I am currently using an overlay layout spec to position them (no idea if that's the right way to go about it).

What I want to be able to do is zoom/pan on the placeholder image for the ASVideoNode.

As a fallback, if that's not possible, I'd like to know if I can do the same with an ASNetworkImageNode instead of an ASVideoNode (I'll find another way to link in / show the video).

Currently, I'm using a delegate of the video node to capture when the image is loaded (it's actually the network image node imageNode(_ imageNode: ASNetworkImageNode, didLoad image: UIImage) callback that's delegated through the video node) and setting the contentSize of the scroll node's view (scrollNode.view.contentSize = image.size).

I am also using that callback to set the delegate for the scroll node's view, because doing so in the init function causes a crash and I'm not really sure what other point to do this at.

What should I return from the viewForZoomingInScrollView call? Is there a better place to set the scroll node's delegate? Is what I'm trying to accomplish even remotely possible?

Thanks!

lukeivers avatar Sep 23 '16 20:09 lukeivers

Hey @lukeivers can you please provide an example project so we would be able to understand a bit better what and how you would like to accomplish it a bit better? Thanks!

maicki avatar Nov 09 '16 00:11 maicki

@lukeivers did you find a solution? I am running into similar issue. Not sure how to pan/zoom ASImageNode (or ASNetworkImageNode) inside ASScrollNode.

rajeevwhiz avatar Nov 23 '16 16:11 rajeevwhiz

@rajeevwhiz @lukeivers - could you elaborate a bit more on the UI you are trying to achieve and why you are using a ASScrollNode over a collection or table?

hannahmbanana avatar Jan 13 '17 00:01 hannahmbanana

So, I’ve moved on and have solved my problems to some extent another way.

I suppose I might be able to solve it using a table (or collection), but the page isn’t really tabular, so I was trying to just use the most accurate set of components for my goal.  I try to avoid using tables simply for layout reasons for the same reason that it’s recommended to not use tables for layout within websites, even though in a lot of cases that makes it easier to render your view the way you want.

The best way to explain what I am doing (I simply dropped out of ASDK for rendering these screens for the time being) is it’s like viewing a photo album on Facebook, where there’s an image that takes up the vast majority of the screen, with text/etc info below the image.

The two complications are

  1. The image resolution is well above what can be shown within the screen, and the user needs to be able to zoom into various portions of the image (this is literally the entire purpose of this screen).
  2. The text/etc below the image will in most cases extend below the bottom of the screen, so the user needs to be able to scroll the entire screen down in addition to being able to pan/zoom within the image.

The whole thing is contained within a collection view (of the set of images).  It does full screen swipe left/right between items in the image collection.

So, as you can see, I have like 4 or 5 different pan/scroll/swipe actions all layered on top of each other within the screen.

I already have code to manage the relationship between those.  I got it to faithfully reproduce everything I am doing within the non ASDK-based screen, with the single exception of being able to actually pan/zoom on the image.

All that being said, if the only thing I need to do to make this work is swap out the ASScrollNode for a table, I will do that ASAP.  The code I had to write to emulate some of the under the cover stuff in ASDK is awful and ugly, and I would LOVE to get rid of it and just use ASDK here.

Thanks, Luke

On Jan 12, 2017, 4:39 PM -0800, Hannah Troisi [email protected], wrote:

@rajeevwhiz @lukeivers - could you elaborate a bit more on the UI you are trying to achieve and why you are using a ASScrollNode over a collection or table? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lukeivers avatar Jan 16 '17 19:01 lukeivers

Hey Luke, glad you got it up and running! We'd like to modify ASDK to suit this use case – it would be incredibly great to see some sample code if possible.

Adlai-Holler avatar Feb 09 '17 19:02 Adlai-Holler

Going to close this out since there hasn't been a reply in a few months.

garrettmoon avatar May 01 '17 22:05 garrettmoon