簡體   English   中英

UITableviewcell.accessoryview觸地得分?

[英]UITableviewcell.accessoryview touchDown?

在UITableviewCell.accessoryview上,我想在touchUpInside動作上調用-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath方法。 關於如何實現這一目標的任何想法都是很棒的。

我建議將表格視圖單元格的accessoryView屬性設置為自定義UIButton實例,然后設置自定義選擇器以處理您想執行的任何觸摸事件:( 此代碼未經測試,FYI

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

您可以用您選擇的自定義選擇器替換actionSelector ,並用所需的任何事件標志替換UIControlEventTouchDown ,例如UIControlEventTouchUpInside有關動作選擇器的更多詳細信息 )。

希望能有所幫助。

沒有這種內置的“ Touch Down”方法。

並且TouchUpInside會自動調用annexButtonTapped方法。

您可以為此嘗試一些自定義解決方案,但是我不確定它的效率如何以及如何自定義它。

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM