Los datos que no se muestran en la celda de vista de tabla personalizada en Swift han agregado la clase de celda a continuación
He intentado todo lo posible, pero todavía no puedo entender por qué los datos no se muestran en una celda personalizada. Se ve bien en unsubTitle
celular yprintln
confirma que los datos están ahí. He comprobado el identificador y elIBOutlets
a 100 veces:
// ActivityDetailsTableViewController.swift
// TestActForm
//
// Created by Jeremy Andrews on 2015/08/08.
// Copyright (c) 2015 Jeremy Andrews. All rights reserved.
//
import UIKit
class ActivityDetailsTableViewController: UITableViewController
{
var activities: [Activity] = activityProfile
override func viewDidLoad()
{
super.viewDidLoad()
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int
{
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return activities.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
-> UITableViewCell
{
let cell = tableView.dequeueReusableCellWithIdentifier("ActivityDetail", forIndexPath: indexPath) as! ActivityDetailCell
let activity = activities[indexPath.row] as Activity
println(activity.question)
cell.questionLabel?.text = activity.question
cell.answerLabel?.text = activity.answer
println(cell.questionLabel.text)
return cell
}
}
import UIKit
class ActivityDetailCell: UITableViewCell
{
@IBOutlet weak var questionLabel: UILabel!
@IBOutlet weak var answerLabel: UILabel!
override func awakeFromNib()
{
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool)
{
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}