如何在iphone的tableview中找到accessoryType点击

Nit*_*tin 6 iphone objective-c ios

我需要在iphone的accessoryTypetableview中accessoryType点击一下UITableView.我可以找到点击进入iphone.

Rob*_*bin 9

你需要在中定义accessoryType单元格

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

像这样

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
Run Code Online (Sandbox Code Playgroud)

该accessoryType的行选择方法是

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

但是,如果要为单元格定义任何其他accessoryType,则可以使用此方法.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)


Ish*_*shu 6

为此目的使用此委托方法

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

单击附件时会触发此消息