回答
嘗試這樣,
你在didSelectRowAtIndexPath方法方法得到的值。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(%@"%d", indexPath.row);
NSLog(%@"%d", indexPath.section);
}
您取得particuler節中的行數,然後使用
[tableView numberOfRowsInSection:indexPath.section];
編輯: -
UITableViewCell* cell = (UITableViewCell*)button.superview;
這裏you'l獲得所選單元格,並通過使用這種細胞可以更改標籤的值。
用於獲取indexpath值當點擊按鈕,可以使用下面這行代碼,
NSIndexPath *indexPath = [yourtableviewname indexPathForCell:(UITableViewCell *)sender.superview];
NSLog(@"%d",indexPath.row);
請看我編輯的問題一次 – Krishna1251 2013-05-03 14:53:36
@ Krishna1251:如果這個答案可以幫助你,那麼接受它來清理社區。 – Balu 2013-05-09 16:05:41
落實tableView:didSelectRowAtIndexPath:
方法。 NSIndexPath
參數具有您可以訪問的section
和row
屬性。
請看我編輯的問題一次 – Krishna1251 2013-05-03 14:52:28
實施
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int row=indexPath.row;
int section=indexPath.section
}
當用戶點擊一行
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//section:
NSInteger section = indexpath.section
//row:
NSinteger row= indexpath.row
}
被調用。
查找選定的索引路徑:NSIndexPath *selectedRowIndexPath = [self.tableview indexPathForSelectedRow];
,然後使用NSUInteger selectedRow = selectedRowIndexPath.row;
獲取選定的行,並使用NSUInteger selectedSection = selectedRowIndexPath.section;
獲取選定的部分。
我得到0的每件事情....對於你的代碼 – Krishna1251 2013-05-03 11:35:11
請看我編輯的問題一次 – Krishna1251 2013-05-03 14:53:05
- 1. 如何讓ajax調用獲取部分視圖包含javascript?
- 2. 如何在腳本部分的視圖中包含腳本包
- 3. 如何在視圖中包含組合?
- 4. 獲取視圖以適合
- 5. 獲取子視圖包含視圖
- 6. 圖像適合包含Div
- 7. 獲取包含字符串的行號
- 8. 如何獲取文本在方括號中包含方括號?
- 9. 如何在QUrl中包含百分號?
- 10. 如何獲取包含GPUImageView的視圖的屏幕截圖?
- 11. 如何在獲取模型對象的視圖中調用期望獲得IEnumerable集合的分部視圖?
- 12. 如何在Django視圖中獲取url的一部分?
- 13. 只包含ASP.NET的部分視圖的一部分Razor MVC
- 14. 如何返回到包含渲染部分的視圖
- 15. MVC3:如何發佈包含部分視圖的表單?
- 16. 包含的視圖覆蓋父視圖的部分
- 17. 如何獲取包含子視圖在內的所有視圖總數
- 18. 如何在ConfigurationElement中包含CDATA部分?
- 19. 適合圖像到outtermost div,適合包含圖像的div
- 20. 獲取包含數據的最小/最大行號的行號?
- 21. 獲取包含當前行的部分的數量
- 22. 如何獲取ResultSet包含的行數?
- 23. Tesseract適用於僅包含文本的圖像 - 裁剪圖像僅獲取圖像中的文本部分
- 24. 如何在包含SQLite3數據庫的表視圖中實現部分?
- 25. 如何在包含SQLite數據庫的表視圖中實現部分?
- 26. 獲取包含在地圖
- 27. 從包含它的類中獲取enum.values()
- 28. 如何檢查div標籤是否包含部分視圖?
- 29. 在django中包含泛型視圖 - 如何正確使用它?
- 30. 如何使用包含部分視圖的參數運行SQL查詢?
爲了得到一個有意義的答案,請閱讀常見問題的說明http://stackoverflow.com/questions/how-to-ask和我個人最喜歡的:http://mattgemmell.com/2008/12/08/你有什麼試用 – 2013-05-03 10:55:34