At first the indexpath are called in sequence of 0,1,2... but after clicking on the table view , the func tablview is called with indexpath that seems completely random , and hence i am unable to reproduce the same data . I am using array to correlate the rows of the table .
The code is here:
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return myList.count
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
// Configure the cell...
println("table view --> ")
let CellID : NSString = "Cell"
var cell : UITableViewCell = tableView?.dequeueReusableCellWithIdentifier(CellID)as UITableViewCell
var VehicleName = cell.viewWithTag(1) as UILabel
var VehicleNumber = cell.viewWithTag(2) as UILabel
if let ip = indexPath
{
VehicleName.text = arrayData[ip.row*2];
VehicleNumber.text = arrayData[ip.row*2+1];
}
}
return cell
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…