Xcode 如何将“披露”按钮设置为UItableViewCell

Xcode 如何将“披露”按钮设置为UItableViewCell,xcode,swift,uitableview,Xcode,Swift,Uitableview,我想设置一个UITableViewCellexposition按钮,但它不起作用。我正在使用: cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator 在该功能中: func tableView ( tableView : UITableView, cellForRowAtIndexPath indexPath: NsIndwxPath )-->UITableViewCell 你可以试试这个 cel

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

cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator 
在该功能中:

func tableView ( tableView : UITableView, cellForRowAtIndexPath indexPath: NsIndwxPath )-->UITableViewCell 
你可以试试这个

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

或者你也可以使用故事板 从文档大纲中选择tableview单元格,转到属性检查器,然后为单元格选择Disclosure indicator,如图所示

你可以试试这个

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

或者你也可以使用故事板 从文档大纲中选择tableview单元格,转到属性检查器,然后为单元格选择Disclosure indicator,如图所示

试试这个

cell.accessoryType = .DetailDisclosureButton


func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {

        }
试试这个

cell.accessoryType = .DetailDisclosureButton


func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {

        }

如果您想在侧面安装按钮,请使用:

cell.accessoryType = .DetailButton
当它被轻触时,用以下方法进行操作:

func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {
    <#code#>
}
func tableView(tableView:UITableView,accessorybuttonattappedforrowWithIndeXPath:NSIndexPath){
}

如果您想在侧面安装按钮,请使用:

cell.accessoryType = .DetailButton
当它被轻触时,用以下方法进行操作:

func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {
    <#code#>
}
func tableView(tableView:UITableView,accessorybuttonattappedforrowWithIndeXPath:NSIndexPath){
}

您使用的是
cell.accessoryType=UITableViewCellAccessoryType.DisclosureIndicator
您使用的是
cell.accessoryType=UITableViewCellAccessoryType.DisclosureIndicator
如何设置每个单元格中显示的
.Detail按钮的字符串?我的意思是,我可以使用
accessoryButtonTappedForRowWithIndexPath
方法的indexPath构造一个单元格,然后一旦我有了这个单元格,我如何为单元格的DetailButton设置一个字符串值
let cell=tableView.cellForRow(at:indepath)
cell?.accessoryView.text//accessoryView上没有可用的文本属性
我相信您必须创建一个自定义的accessoryView才能这样做。检查这个问题:我认为默认情况下会提供一个附件视图,它会在屏幕上与UILabel一样进行自我调整。Thankshow我可以为每个单元格中显示的
.DetailButton
设置一个字符串吗?我的意思是,我可以使用
accessoryButtonTappedForRowWithIndexPath
方法的indexPath构造一个单元格,然后一旦我有了这个单元格,我如何为单元格的DetailButton设置一个字符串值
let cell=tableView.cellForRow(at:indepath)
cell?.accessoryView.text//accessoryView上没有可用的文本属性
我相信您必须创建一个自定义的accessoryView才能这样做。检查这个问题:我认为默认情况下会提供一个附件视图,它会在屏幕上与UILabel一样进行自我调整。谢谢