有誰知道如何確定在UITableView中選定的行或選定的單元格?你能幫我解決這個問題嗎?我真的堅持這個問題爲我的應用程序。iOS:UITableView澄清
回答
致電indexPathForSelectedRow
或indexPathsForSelectedRows
以獲得單個或多個選擇。
當選擇的細胞,您的視圖控制器的這個方法被調用:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
indexPath
包含選定位置。
謝謝dasblinkenlight ...嗯..我可以舉個例子嗎?非常感謝.. – Aldee 2012-01-27 03:23:24
@AldeeMativo絕對!在Xcode中,選擇「幫助/文檔和API參考」。當幫助窗口打開時,在左上角的搜索窗口中輸入「didSelectRowAtIndexPath」(不帶雙引號)。這會給你帶來很多匹配的文件。在列表的底部,你會發現十幾個樣本,檢查他們 - 他們演示了這種方法的工作原理。 – dasblinkenlight 2012-01-27 03:27:42
真棒..謝謝..它的作品.. – Aldee 2012-01-27 03:30:05
你會希望你的UITableViewDelegate
實現tableView:didSelectRowAtIndexPath:
,這將被髮掘,每當一個行被點擊。
- 1. iOS:UITableView澄清
- 2. 澄清
- 3. 澄清
- 4. 澄清
- 5. 澄清
- 6. 澄清
- 7. glClearBuffer *澄清
- 8. C++澄清
- 9. 的String [] []澄清
- 10. 澄清IntentService
- 11. setDispatched()澄清
- 12. WSGI/Apache澄清
- 13. 的GroupBy澄清
- 14. Rails.last澄清
- 15. MIPS .word澄清
- 16. 澄清代碼
- 17. SQLiteOpenHelper澄清
- 18. 澄清佈局
- 19. AutoResetEvent澄清
- 20. BackgroundTask澄清
- 21. facebook access_token澄清
- 22. Document.ready澄清?
- 23. NSNotificationCenter澄清
- 24. MDR澄清
- 25. 澄清界定
- 26. 澄清在iOS
- 27. Interlocked.Exchange澄清
- 28. ViewContainerRef&createEmbeddedView澄清?
- 29. Spark groupByKey澄清
- 30. Grails addTo *澄清
不確定你在找什麼。你看過UITableView文檔嗎? http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html – mservidio 2012-01-27 03:14:08
是的..但我只想要一個代碼,當這個單元格被選中時,會有一個警報那會發生..你能幫我嗎? – Aldee 2012-01-27 03:18:33
有誰知道如何確定選定的行或UITableView中的選定單元格....什麼?澄清你的問題。這實際上是一個問題的一半。 – NJones 2012-01-27 03:20:19