Comment afficher l'étiquette lors de l'affichage de tableau est vide

Je suis à essayer de comprendre comment afficher un message à l'intérieur d'une vue de la table, quand la table est vide. Je tiens à dire quelque chose comme: "Vous n'avez pas ajouté de transactions encore. Appuyez sur le bouton ajouter pour obtenir commencé.". Évidemment, j'aurais besoin de revenir à ce message si l'utilisateur supprime toutes les cellules, trop.

C'est le code que j'ai actuellement dans ma table view controller:

class ThirdViewController: UITableViewController {
override func viewWillAppear(animated: Bool) {
self.tableView.reloadData()
}
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.
}
//#pragma 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 arrayObject.paymentsArray().count
}
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell:CustomTransactionTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as CustomTransactionTableViewCell
cell.paymentNameLabel.text = (arrayObject.paymentsArray().objectAtIndex(indexPath.row)) as String
cell.costLabel.text = (arrayObject.costArray().objectAtIndex(indexPath.row)) as String
cell.dateLabel.text = (arrayObject.dateArray().objectAtIndex(indexPath.row)) as String
if arrayObject.imageArray().objectAtIndex(indexPath.row) as NSObject == 0 {
cell.paymentArrowImage.hidden = false
cell.creditArrowImage.hidden = true
} else if arrayObject.imageArray().objectAtIndex(indexPath.row) as NSObject == 1 {
cell.creditArrowImage.hidden = false
cell.paymentArrowImage.hidden = true
}
return cell
}
override func tableView(tableView: UITableView!, canEditRowAtIndexPath indexPath: NSIndexPath!) -> Bool {
return true
}
override func tableView(tableView: UITableView!, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath!) {
if (editingStyle == UITableViewCellEditingStyle.Delete) {
if let tv=tableView {
arrayDataCost.removeObjectAtIndex(indexPath!.row)
arrayDataImage.removeObjectAtIndex(indexPath!.row)
arrayDataPayments.removeObjectAtIndex(indexPath!.row)
arrayDataDate.removeObjectAtIndex(indexPath!.row)
tv.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
}
}
}
}

Toute aide serait grandement appréciée!

OriginalL'auteur user3746428 | 2014-07-24