开发者

Is there any difference between UITableViewCellAccessoryDetailDisclosureButton and UITableViewCellAccessoryDisclosureIndicator

I have created a method - (void)tableView:(UITableView *)tableView accessory开发者_如何学运维ButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { for UITableViewCellAccessoryDetailDisclosureButton.

Now I want to use UITableViewCellAccessoryDisclosureIndicator in place of UITableViewCellAccessoryDetailDisclosureButton.

Is there any difference between UITableViewCellAccessoryDetailDisclosureButton and UITableViewCellAccessoryDetailDisclosureButton?


Apple HIG suggests that you use UITableViewCellAccessoryDisclosureIndicator to navigate through hierarchical data, and UITableViewCellAccessoryDetailDisclosureButton to perform some action, possible bringing up an edit view, that may change the data. However, most programmers seem to ignore this.

You can implement the delegate method tableView:didSelectRowAtIndexPath: like this:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
    [self tableView:tableView didSelectRowAtIndexPath:indexPath];
}

Or vice versa.


There is difference. UITableViewCellAccessoryDetailDisclosureButton is actually a button but UITableViewCellAccessoryDisclosureIndicator is not.

You can use UITableViewCellAccessoryDisclosureIndicator instead of UITableViewCellAccessoryDetailDisclosureButton but you can not get the tableView:accessoryButtonTappedForRowWithIndexPath: method called when you tap on the UITableViewCellAccessoryDisclosureIndicator as it is not a button.


Yes, they're different.

Use UITableViewCellAccessoryDetailDisclosureButton when the user tapping the blue button performs a different action than tapping the rest of the row, even if the rest of the row does nothing.

Use UITableViewCellAccessoryDisclosureIndicator when the entire row is tappable and produces the same action.

If your behaviour is something else, use some other mechanism.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜