我試圖從表中選定的行提取所有數據。我使用下面的代碼來打印indexPaths。但是,我需要做些什麼才能打印出選定行中的文本?從indexPathsForSelectedRows()中提取數據 - SWIFT
let indexPaths:NSArray = tableView.indexPathsForSelectedRows()!
`for var i = 0; i < indexPaths.count; ++i {
var thisPath:NSIndexPath = indexPaths.objectAtIndex(i) as NSIndexPath
println("row = \(thisPath.row) and section = \(thisPath.section)")
}
打印到控制檯所選行
row = 1 and section = 0
row = 3 and section = 0
row = 6 and section = 0
從數據模型中獲取數據的方式與您在cellForRowAtIndexPath中獲取的數據完全相同? – nhgrif 2014-11-23 13:25:38