mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-03-26 10:04:32 +08:00
Update README.md
This commit is contained in:
18
README.md
18
README.md
@@ -61,16 +61,16 @@ In Swift:
|
||||
|
||||
```swift
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) {
|
||||
let node = ASTextNode()
|
||||
node.attributedString = NSAttributedString(string: "hello")
|
||||
node.measure(CGSize(width: screenWidth, height: CGFloat.max))
|
||||
node.frame = CGRect(origin: CGPointZero, size: node.calculatedSize)
|
||||
let node = ASTextNode()
|
||||
node.attributedString = NSAttributedString(string: "hello")
|
||||
node.measure(CGSize(width: screenWidth, height: CGFloat.max))
|
||||
node.frame = CGRect(origin: CGPointZero, size: node.calculatedSize)
|
||||
|
||||
// self.view isn't a node, so we can only use it on the main thread
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.view.addSubview(node.view)
|
||||
}
|
||||
}
|
||||
// self.view isn't a node, so we can only use it on the main thread
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.view.addSubview(node.view)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
AsyncDisplayKit at a glance:
|
||||
|
||||
Reference in New Issue
Block a user