Nitin
Nitin

Reputation: 151

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.

Upvotes: 6

Views: 1474

Answers (2)

Robin
Robin

Reputation: 10011

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

Upvotes: 9

Ishu
Ishu

Reputation: 12787

use this delegate method for this purpose

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

This fires when you click on accessory

Upvotes: 6

Related Questions