Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find accessoryType click in tableview in iphone

i need to do something on accessoryType click in tableview in iphone.how can i find accessoryType click in UITableView in iphone.

like image 850
Nitin Avatar asked Feb 28 '11 04:02

Nitin


2 Answers

you need to define the accessoryType of the cell in the

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

like this

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

the method for row selection of this accessoryType is

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

but if you are defining any other accessoryType for cell than you can use this method.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
like image 198
Robin Avatar answered Sep 21 '22 01:09

Robin


use this delegate method for this purpose

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

This fires when you click on accessory

like image 33
Ishu Avatar answered Sep 20 '22 01:09

Ishu