I have a custom UITableViewCell set up and it's not displaying any of the content. When the TableView was hooked up to the default cell it displayed the content. I have QuoteyTableViewCell set as the class for the cell in my storyboard. Not sure what I'm doing wrong, here's my code. Thanks :).
import UIKit
class KeepTableViewController: UITableViewController {
var keptQuotes : Array> = [[
"quote": "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.", "author" : "H. Jackson Brown Jr"],[ "quote": "Be yourself; everyone else is already taken.", "author" : "Oscar Wilde"],[ "quote": "I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel.", "author" : "Maya Angelou" ],[ "quote": "If you tell the truth, you don't have to remember anything.", "author" : "Mark Twain" ] ] override func viewDidLoad() { super.viewDidLoad() // Uncomment the following line to preserve selection between presentations // self.clearsSelectionOnViewWillAppear = false // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // 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 keptQuotes.count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell : QuoteyTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath:
indexPath) as QuoteyTableViewCell
// Configure the cell... cell.authorLabel.text = keptQuotes[indexPath.row]["author"] cell.quoteTextView.text = keptQuotes[indexPath.row]["quote"] return cell }
and the cell class:
import UIKit
class QuoteyTableViewCell: UITableViewCell {
@IBOutlet weak var authorLabel: UILabel! @IBOutlet var quoteTextView: UITextView! 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 }
}
Thanks again :)
QuoteyTableViewCell
assigned as well as the reuse identifier "Cell" ? - zisoft