gpt4 book ai didi

ios - 如何在 swift 3 中使用 AsyncDisplayKit 制作段 Controller

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:30:58 26 4
gpt4 key购买 nike

我有两个 ASTableNode1.通知tabelNode2.评论tabelNode现在我想将段 Controller 作为表上的粘性标题,当我单击通知段时,通知表应该出现,当我单击评论段时,评论表应该如图所示显示 enter image description here 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com