ios - How to you save a string to a table View? -


this code:

import uikit  var reminder = [string]()  class viewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource {      @iboutlet weak var textfield: uitextfield!      @ibaction func checkmarktapped(sender: anyobject) {         reminder.append(textfield.text!)         textfield.text = ""     }      @ibaction func addreminder(sender: anyobject) {     }      func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {         return reminder.count     }      func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {         var cell:coustemcell = tableview.dequeuereusablecellwithidentifier("cell") as! coustemcell         cell.tableviewlabel.text = reminder[indexpath.row]         return cell     } } 

so when ever press on checkmarktapped add whatever being put in textfield table view. code put in checkmarktapped suppose work keeps crashing.

so doing wrong?

import uikit  class viewcontroller: uiviewcontroller {     var reminder = [string]()     @iboutlet weak var tbl_update: uitableview!      override func viewdidload()     {         super.viewdidload()     }      override func didreceivememorywarning()     {         super.didreceivememorywarning()     }      @iboutlet weak var textfield: uitextfield!      @ibaction func checkmarktapped(sender: anyobject)     {         reminder.append(textfield.text!)         textfield.text = ""         tbl_update.reloaddata()     }      @ibaction func addreminder(sender: anyobject)     {      }      func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int     {         return reminder.count     }      func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell     {         let cell:coustemcell = tableview.dequeuereusablecellwithidentifier("cell") as! coustemcell         cell.tableviewlabel.text = reminder[indexpath.row]         return cell     }  } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -