2010-01-25 34 views
11

我試圖在UITableView特定類鏈接作爲附件按鈕的點擊的方法。該附件位於多個單元格中,由代碼創建,因此我不能像我習慣的那樣僅僅在界面生成器中進行簡單鏈接。iPhone的UITableView - 對附件行動點擊

如何鏈接附件箭頭(從一個UITableView電池的端)的方法?

回答

29

時退房tableView:accessoryButtonTappedForRowWithIndexPath:方法上UITableViewDelegate

+1

完美的感謝。 – oberbaum 2010-01-25 17:36:22

+0

當爲indexPath處的行設置附件視圖時,不會調用此方法。 – commando24 2016-10-14 11:40:41

0

這不再有效,Xcode標記了一個警告,它現在被解除了;

警告:由於使用傳統的單元佈局委託執行的tableView的:accessoryButtonTappedForRowWithIndexPath:英寸請移除此方法的實施並將單元格屬性accessoryType和/或editingAccessoryType設置爲移至新單元格佈局行爲。此方法將不再在未來版本中調用。 在這裏看到:https://developer.apple.com/documentation/uikit/uitableviewdelegate

+1

無法重現此操作。它沒有在[https://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html](iOS開發人員類參考)中被標記爲棄用,我得到了新的警告在Monodevelop(2.8.6.5,MonoTouch 5.2.5,Xcode 4.2.1)... – basti 2012-03-19 08:50:57

+0

我同意@chiffre。 [UITableViewDelegate協議參考](https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html)不列出'tableView:accessoryButtonTappedForRowWithIndexPath'作爲折舊。 – 2014-05-01 00:26:27

+1

它是* Tapped *,而不是* Type * – kabiroberai 2015-09-26 10:26:38