xcode 如何使用详细信息披露按钮?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14554719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:38:55  来源:igfitidea点击:

How do I use the Detail Disclosure button?

iosxcodedisclosure

提问by Lorenz de Guzman

I'm new to Xcode and I need to know how to use the Detail Disclosure button that I have added to my table. The round blue arrow button when pressed will redirect the user to another ViewController, and in that ViewController, the data in the selected row will be displayed. I'll be using it for updating purposes. I'm apologize for my lack of knowledge about iOS programming. Please be patient with me. Thanks! :)

我是 Xcode 的新手,我需要知道如何使用我添加到我的表中的 Detail Disclosure 按钮。按下圆形蓝色箭头按钮会将用户重定向到另一个 ViewController,在该 ViewController 中,将显示所选行中的数据。我将使用它进行更新。对于我缺乏 iOS 编程知识,我深表歉意。请对我有耐心。谢谢!:)

回答by Tommy Devoy

The correct tableView delegate method is :

正确的 tableView 委托方法是:

-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

-Basically the detail disclosure button is useful for displaying some extra info in your tableView other than the main info that is invoked when the user selects the row (i.e. the didSelectRowAtIndexPath method)

- 基本上,详细信息披露按钮对于在 tableView 中显示一些额外信息很有用,而不是在用户选择行时调用的主要信息(即 didSelectRowAtIndexPath 方法)

回答by Ketan P

Delegate Method In Swift 3.0

Swift 3.0 中的委托方法

func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {

}

But for Use this delegate : you can use either of following two accessory Type :

但是对于使用此委托:您可以使用以下两种附件类型之一:

cell.accessoryType = .detailDisclosureButton
cell.accessoryType = .detailButton

回答by Bill Burgess

All the detail disclosure indicator does is let the user know that they can (and should) tap on the cell or arrow to show more information. To show the additional information, you will want to handle the -didSelectRowAtIndexPathdelegate method for your tableview. From there you can push another view controller or show anything relevant to your selected cell.

详细信息披露指示器所做的就是让用户知道他们可以(并且应该)点击单元格或箭头以显示更多信息。要显示附加信息,您需要处理-didSelectRowAtIndexPathtableview的委托方法。从那里您可以推送另一个视图控制器或显示与您选择的单元格相关的任何内容。