jeudi 29 octobre 2015

Swift/iOS - UITableView with UITableViewCell not populating results

enter image description hereBasically, i'm trying to get my TableView with SQLITE results but it is not popluating at all. The weird part is i edited an Example Project of sqlite to do the same, but from my database instead and it worked.

Also, in my project, which has the exact same code as the SQLITE example project, except the cell name and such, i can create an Alert to display one of the results from the array, and it works fine.

I don't get why it won't populate.

Sorry if i can't explain it well, but here's my code and an example of it trying to work with no TV results but with an alert.

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return returnedCardNames.count
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell:CardInfo_Cell = tableView.dequeueReusableCellWithIdentifier("cardCell") as! CardInfo_Cell
    let card_name:CardInfo_Adapter = returnedCardNames.objectAtIndex(indexPath.row) as! CardInfo_Adapter
    cell.card_nameLabel.text = "\(card_name.CardName)"
    return cell
}

override func viewWillAppear(animated: Bool) {
    self.getCardNames()
}

func getCardNames()
{
    returnedCardNames = NSMutableArray()
    returnedCardNames = Card_Adapter.getInstance().getAllSimilarCardNamesByUserEntry("null", passedSetName: "null")
    cardResults.reloadData()

    let card_name:CardInfo_Adapter = returnedCardNames.objectAtIndex(10) as! CardInfo_Adapter
    Util.invokeAlertMethod("Card Results", strBody: card_name.CardName, delegate: nil)
}

enter image description here

Aucun commentaire:

Enregistrer un commentaire