开发者

UITableviewcell.accessoryview touchDown?

On the UITableviewCell.accessoryview I would like to have the -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath method be called on the touchUpInside action. Any ideas on h开发者_如何学Goow to achieve this would be great.


I would recommend setting the table view cell's accessoryView property to a custom UIButton instance and then setting a custom selector to handle whatever touch event you want to do: (this code is not tested, FYI)

UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[button addTarget:self action:@selector(actionSelector) forControlEvents:UIControlEventTouchDown];
cell.accessoryView = button;

You can replace actionSelector with a custom selector of your choice and UIControlEventTouchDown with whatever event flag you desire, such as UIControlEventTouchUpInside (more details for action selectors).

Hope that helps.


There is no such in-built "Touch Down" method.

And TouchUpInside would automatically call accessoryButtonTapped method.

You may try some custom work around for that but I am not sure how efficient it would be and how you would be able to customize it.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜