[Question] How to add ASScrollNode into ASCellNode?
Hi All, I want to display 2-3 image in a cell on table. I did create a ASScrollNode and add it into ASCellNode but I don't use it. My code:
@interface MyCell:ASCellNode
{
ASScrollNode *_scrollNode;
}
@end
@implementation
- (id)init {
self = [super init];
if(self) {
_scrollNode =[ [ASScrollNode alloc] init];
[self addSubnode:_scrollNode];
}
return self;
}
@end
ASScrollNode is a lightweight wrapper around UIScrollView, so you can interact with them both the same way — instead of adding image views as UIScrollView subviews, you can add image nodes as ASScrollNode subnodes. The Ray Wenderlich UIScrollView tutorial might be helpful, though note that you'll have to implement your scroll node in code, not Interface Builder.
Thanks secretiverhyme :). I did add a ASScrollNode in to ASCellNode and I add two ASImageNode into ASScrollNode but I can't set content size for this ASScrollNode. Could you help me about this?
The view property on ASScrollNode is a UIScrollView, so you should be able to do
_scrollNode.view.contentSize = CGSizeMake(width, height);
with the caveat that accessing this property will force the view to be loaded. contentSize and friends aren't available on ASScrollNode itself (pull requests welcome! check out the UIViewBridge category for reference) so in order to avoid loading the UIScrollView too soon and locking the scroll node to the main thread, you should set contentSize in your cell node's -layout implementation.
Many thanks to secretiverhyme. You help me so much :). One more issue: UI look like "blur" when I use ASTextNode, ASImageNode... so how clear it?
@nttravn do you experience the blur issue with the ASDK current version ?
@nttravn - I'm very sorry for the delay in response to your blur issue. Are you still having this problem? If so, I'd be very happy to help you out if you can describe more details of the problem.
I hope you've been able to use the framework!
@nttravn: thanks for contributing to the AsyncDisplayKit community by asking your question here! Due to the length of time it’s been since this thread was active, I’m going to mark this issue as closed. If you are still having troubles, feel free to reopen it. I hope you have been able to use the framework!