mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-03-30 16:53:29 +08:00
1.5 KiB
Executable File
1.5 KiB
Executable File
title, layout, permalink, prevPage, nextPage
| title | layout | permalink | prevPage | nextPage |
|---|---|---|---|---|
| ASScrollNode | docs | /docs/scroll-node.html | video-node.html | automatic-layout-containers.html |
ASScrollNode is literally a wrapped UIScrollView.
Basic Usage
In case you're not familiar with scroll views, they are basically windows into content that would take up more space than can fit in that area.
Say you have a giant image, but you only want to take up 200x200 pts on the screen.
SwiftObjective-C
UIImage *scrollNodeImage = [UIImage imageNamed:@"image"];
ASScrollNode *scrollNode = [[ASScrollNode alloc] init];
scrollNode.preferredFrameSize = CGSizeMake(200.0, 200.0);
UIScrollView *scrollNodeView = scrollNode.view;
[scrollNodeView addSubview:[[UIImageView alloc] initWithImage:scrollNodeImage]];
scrollNodeView.contentSize = scrollNodeImage.size;
let scrollNodeImage = UIImage(named: "image")
let scrollNode = ASScrollNode()
scrollNode.preferredFrameSize = CGSize(width: 200.0, height: 200.0)
let scrollNodeView = scrollNode.view
scrollNodeView.addSubview(UIImageView(image: scrollNodeImage))
scrollNodeView.contentSize = scrollNodeImage.size
As you can see, the scrollNode's underlying view is a UIScrollView.