1
简单的细胞,我试图建立与Facebook的AsyncDisplayKit下面的设计,我必须建立细胞和TableHeaderView问题。与AsyncDisplayKit布局
设计:
细胞:
所以每个单元都有一个ASImageNode
,并具有以下布局一个ASEditableTextNode
:
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
var cellChildren = [ASLayoutElement]()
let iconTextfieldStack = ASStackLayoutSpec.horizontal()
iconTextfieldStack.alignItems = .center
iconTextfieldStack.justifyContent = .start
iconTextfieldStack.style.flexShrink = 1.0
iconTextfieldStack.style.flexGrow = 1.0
_iconImageView.style.preferredSize = CGSize(width: 30, height: 30)
cellChildren.append(ASInsetLayoutSpec(insets: UIEdgeInsetsMake(10, 10, 10, 10), child: _iconImageView))
_textField.style.spacingBefore = 10
cellChildren.append(ASInsetLayoutSpec(insets: UIEdgeInsetsMake(0, 0, 0, 10), child: _textField))
iconTextfieldStack.children = cellChildren
return ASInsetLayoutSpec(insets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0), child: iconTextfieldStack)
}
结果看起来像这个:
正如可以看到第三行ASEditableTextNode
超过细胞宽度(第一个问题)。另一件事是ASEditableTextNode
不扩展其高度(和单元格高度)以显示ASEditableTextNode
文本的行。另外我得到这个警告:
-[UIWindow endDisablingInterfaceAutorotationAnimated:] called on <UIRemoteKeyboardWindow: 0x1024c9c00; frame = (0 0; 375 667); opaque = NO; autoresize = W+H; layer = <UIWindowLayer: 0x17022e4c0>> without matching -beginDisablingInterfaceAutorotation. Ignoring.
有没有办法做到这一点?