iOS-具有详细信息披露按钮时的表行/单元格行为?

标签 ios

在我的表格 View 中,我有一定数量的行,并且所有行都有一个详细信息披露按钮,单击详细信息披露按钮会将用户带到一个新 View ,在 TextView 中显示信息。我无法得出用户点击该行时该行的行为方式的结论,因为 Apple 的表格 View 和详细信息披露按钮指南令人困惑。

谁能为我解释以下两种情况。提前致谢。

  1. 只有当用户点击详细信息披露按钮时新 View 才会滑入并且当用户点击行中的其他地方时没有任何反应是否正确。
  2. 如果用户点击有关突出显示的详细信息披露按钮,应该有什么行为?
  3. 如果用户点击行中的其他位置,表格行的行为应该是什么?

Apple 指南说“当表格行中出现详细信息披露按钮时,点击行中的其他位置不会激活详细信息披露按钮;相反,它会选择行项目或导致应用程序定义的行为。”

Apple table view guidelines 说“当用户点击可选项目时,表格行会短暂突出显示。如果行选择导致导航到新屏幕,则所选行会在新屏幕滑入到位时短暂突出显示。当用户导航回到上一个屏幕,最初选择的行再次短暂突出显示以提醒用户他们之前的选择(它不会保持突出显示)。”

最佳答案

当您点击该行时,将调用此委托(delegate)方法:

– tableView:didSelectRowAtIndexPath:

当您点击详细信息披露按钮时,将调用以下委托(delegate)方法:

– tableView:accessoryButtonTappedForRowWithIndexPath:

tableView:accessoryButtonTappedForRowWithIndexPath:

Tells the delegate that the user tapped the accessory (disclosure) view associated with a given row. - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath Parameters

tableView

The table-view object informing the delegate of this event. indexPath

An index path locating the row in tableView.

Discussion

The delegate usually responds to the tap on the disclosure button (the accessory view) by displaying a new view related to the selected row. This method is not called when an accessory view is set for the row at indexPath. Availability

Available in iOS 2.0 and later.

Declared In UITableView.h

tableView:didSelectRowAtIndexPath:

Tells the delegate that the specified row is now selected. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath Parameters

tableView

A table-view object informing the delegate about the new row selection.  indexPath

An index path locating the new selected row in tableView.

Discussion

The delegate handles selections in this method. One of the things it can do is exclusively assign the check-mark image (UITableViewCellAccessoryCheckmark) to one row in a section (radio-list style). This method isn’t called when the editing property of the table is set to YES (that is, the table view is in editing mode). See "“Managing Selections”" in Table View Programming Guide for iOS for further information (and code examples) related to this method. Availability

Available in iOS 2.0 and later.

See Also

– tableView:willSelectRowAtIndexPath:
– tableView:didDeselectRowAtIndexPath:

Declared In UITableView.h

引用:UITableViewDelegate

关于iOS-具有详细信息披露按钮时的表行/单元格行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13159359/

相关文章:

ios - UITextField 上的下拉菜单?

ios - 加载 View Controller 而不显示 Nib

android - Unity 初学者 - 2d 游戏 : detect position of tap on quad

android - 我想访问所有应用程序的使用时间。我如何在 flutter 中对此进行编程?

ios - 使用 Swift 初始化一个对象以在 Firebase 上获取可选值

ios - 无法从 Xcode 11 上传 .ipa - "The Info.plist indicates an iOS app, but submitting a pkg or mpkg"

ios - 如何从 JSON 创建对象集合

ios - UIViewController 转换在使用下拉手势关闭时闪烁

iphone - 奇怪的内存泄漏

ios - 如何获取 Amazon S3 存储桶中文件夹内的文件列表