Open IvanChan opened 5 years ago
height calculated by ASTextNode2 is higher than ASTextNode, also not center layout in its rect
class ViewController: UIViewController, UIScrollViewDelegate { let text = "爱豆那些事" lazy var aStr = NSAttributedString(string: text, attributes: [.font:UIFont.systemFont(ofSize: 30), .foregroundColor:UIColor.white]) lazy var textNode1:ASTextNode = { let node = ASTextNode() node.attributedText = aStr node.backgroundColor = UIColor.red let layzoutSize = node.calculateLayoutThatFits(ASSizeRangeMake(.zero, CGSize(width: 999, height: 999))) node.frame = CGRect(x: 50, y: 200, width: 300, height: layzoutSize.size.height) return node }() lazy var textNode2:ASTextNode2 = { let node = ASTextNode2() node.attributedText = aStr node.backgroundColor = UIColor.red let layzoutSize = node.calculateLayoutThatFits(ASSizeRangeMake(.zero, CGSize(width: 999, height: 999))) node.frame = CGRect(x: 50, y: 300, width: 300, height: layzoutSize.size.height) return node }() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.view.addSubnode(textNode1) self.view.addSubnode(textNode2) } }
AsdkDEMO.zip
ASButtonNode will have the same problem if using ASTextNode2
height calculated by ASTextNode2 is higher than ASTextNode, also not center layout in its rect
AsdkDEMO.zip