我有两个 ASTableNode 1.通知tabelNode 2.评论tabelNode 现在我想将段 Controller 作为表上的粘性标题,当我单击通知段时,通知表应该出现,当我单击评论段时,评论表应该如图所示显示 WatchList 和 Following Segment,我怎样才能做到这一点,感谢任何帮助。
最佳答案
聚会有点晚了,但希望这对您有所帮助。使用 native View 来显示节点一点也不难。 以下是段控制的实现方式:
///Keep a reference to the segment control
private var segmentedView: UISegmentedControl?
///This node will contain the segment control
private lazy var segmentedNode: ASDisplayNode = {
///The node is initialized with a view block that initializes the segment
return ASDisplayNode(viewBlock: { () -> UIView in
self.segmentedView = UISegmentedControl(items: ["Watchlist", "Following"])
///Select Watchlist maybe? Your call.
self.segmentedView.selectedSegmentIndex = 1
///Configure additional appearance of the segment control
return self.segmentedView
})
}()
之后,在节点上执行您想要的任何节点操作(即包含在堆栈 View 中、设置样式),以及在 native 控件上执行任何您想要的分段控件操作(即值更改选择器)。
关于ios - 如何在 swift 3 中使用 AsyncDisplayKit 制作段 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47216971/