索引号码放在表格中

时间:2015-06-17 10:36:10

标签: ios swift uitableview

如果我点击第一个单元格它会显示我的索引编号为3,如果再次单击它它会显示我的其他索引编号

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cellIdentifier = "CELL"
    let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! CustomTableViewCell

    cell.nameLabel!.text     = restaurantNames[indexPath.row]
    cell.locationLabel!.text = restaurantLocations[indexPath.row]
    cell.typeLabel!.text     = restaurantTypes[indexPath.row]

    cell.thumbnailImageView!.image = UIImage(named:resturantImages[indexPath.row])
    cell.thumbnailImageView!.layer.cornerRadius = cell.thumbnailImageView.frame.size.width  / 2
    cell.thumbnailImageView!.clipsToBounds = true

    return cell
}

0 个答案:

没有答案