This is a demo about how to use ASDK(AsyncDisplayKit / Texture) 中文介绍
- ASImageNode
- ASTextNode
- ASButtonNode
- ASTableNode
- ASCollectionNode
- Inset
- Stack
- Relative & center
- Ratio
- Overlay & background
- Absolute
- Waiting
how to use ASDK
License: MIT License
This is a demo about how to use ASDK(AsyncDisplayKit / Texture) 中文介绍
Could you please help me.
I have ASCellNode
This cell should be present, an array of ASDisplayNode(contentNodes
) in an ASStackLayoutSpec
I want to make the ASStackLayoutSpec
rounded corner, I tried lots of different approaches, but I can't, are you have some advice?
for example, I used ASBackgroundLayoutSpec
with a background bubble, but it doesn't worked!
import Foundation
import AsyncDisplayKit
public class CardCellNode: ASCellNode {
let contentNodes: [CardContentNode]
private let card: Card
private let bubbleNode = ASImageNode()
init(card: Card, contentNodes: [CardContentNode]) {
self.contentNodes = contentNodes
self.card = card
super.init()
for contentNode in contentNodes {
addSubnode(contentNode)
}
self.style.flexGrow = 1.0
self.style.flexShrink = 1.0
selectionStyle = .none
bubbleNode.image = R.image.bubble()
bubbleNode.style.flexShrink = 1
// addSubnode(bubbleNode)
}
public override func didLoad() {
super.didLoad()
for contentNode in contentNodes {
contentNode.backgroundColor = card.backgroundColor.hasPrefix("#") ? UIColor(hexString: card.backgroundColor) : .white
// contentNode.cornerRadius = 10
isUserInteractionEnabled = true
}
}
public override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
let contentVerticalStack = ASStackLayoutSpec.vertical()
contentVerticalStack.style.flexShrink = 1.0
contentVerticalStack.style.flexGrow = 1.0
contentVerticalStack.style.spacingAfter = 5.0
contentVerticalStack.style.spacingBefore = 5.0
contentVerticalStack.children = contentNodes
let contentSpec = ASInsetLayoutSpec(insets: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10), child: contentVerticalStack)
return contentSpec
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.