gpt4 book ai didi

xcode - 如何将披露按钮设置为 UItableViewCell

转载 作者:行者123 更新时间:2023-11-28 08:36:47 25 4
gpt4 key购买 nike

我想设置一个 UITableViewCell 显示按钮,但它不起作用。我正在使用:

cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator 

在这个函数中:

func tableView ( tableView : UITableView, cellForRowAtIndexPath indexPath: NsIndwxPath )-->UITableViewCell 

最佳答案

你可以试试这个

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var CellIdentifier: String = "Cell"
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(CellIdentifier)
if cell == nil {
cell = UITableViewCell(frame: CGRectZero, reuseIdentifier: CellIdentifier)
}
cell.accessoryType = .DetailDisclosureButton
return cell
}

或者您可以使用 Storyboard来完成从文档大纲中选择您的 tableview 单元格,然后转到属性检查器并为您的单元格选择 disclourse 指示器,如图所示

enter image description here

关于xcode - 如何将披露按钮设置为 UItableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37523982/

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