私はtableviewを持っています。私はtableViewCellでボタンを使用する必要があります。私は別のcell.Howのためにdifferntアクションを実行する必要がありますどのセルのボタンがクリックされたかを区別する?Button in UItableviewcell
1
A
答えて
2
あなたがしなければなりませんcellforrowatindex delegate for UITableViewCellのボタン用のタグが設定されているので、そのボタンのアクションでタグをチェックする必要があります。
1
あなたはセルのindexPath.rowにUIButtonのタグプロパティを設定することができます。
button.tag = indexPath.row
次に、あなたが行うことができますあなたのボタンの選択方法、で:
-(void)handleButtonClick:(id)sender
{
UIButton *button = (UIButton*)sender;
indexPathRow = button.tag;
}
関連する問題
- 1. スワイプジェスチャーUIImageView in UITableViewCell
- 2. iPhone MKMapView in UITableViewCell
- 3. Center Google Sign In Button
- 4. font-awesome CSS in button
- 5. Slide in Button UITableView Xcode
- 6. label not clearint in uitableviewcell
- 7. UIImage in self sizing UITableViewCell stretching
- 8. <a href> inside a button in wordpress
- 9. ViewPager call in Button任意のフラグメント
- 10. プロパティ 'style' of nullを読み取れません - Google Sign-In Button
- 11. デザイン<a href>, <button>, <input> in JSP
- 12. UITableviewcellのハンドルボタンイベント
- 13. Matlab Guide Button Glitch-
- 14. html - <input type = button>と<button>
- 15. UITableViewCellの設定
- 16. スワイプタッチなしのUITableViewCell
- 17. DynamicRadio Button
- 18. JQuery clickin 'button
- 19. UITableViewcellメモリリーク
- 20. UITableViewCellのCheckBox付きCoreData
- 21. 再帰的UITableViewCellボタンアクション
- 22. android app search button
- 23. WebPart-Button Click
- 24. UITableViewCell UIButtonの選択
- 25. AngularJS Force Back Button Route
- 26. iphone、UITableField in UITableView
- 27. React Navigation - Stack Navigation Button
- 28. <button>の違いを教えてくださいClick Me!</button>と<button type = "button"> Click Me!</button>?
- 29. Like Facebook Page button
- 30. Button OnClickイベントAndroid
サブビューとして追加し、タグをindexPathの行と同じに設定します。 – CodaFi
タグの使用はごみです。より良い方法については、http://stackoverflow.com/questions/9274494/how-to-know-the-uitableview-row-numberを参照してください。 – jrturton