所以,我有麻煩 - 無法重新裝載TableView的數據,在命令行我看到好數據 - 當我點擊按鈕idMeet
被更改,但在模擬器中我看不到刷新點擊按鈕後的表格視圖,並且idMeet
已更改,我的查詢也已更改。我明白我必須使用tableView.reloadData()
,但不明白在哪裏編寫正確的工作?reloadData()不在快速工作
var x = true;
@IBOutlet weak var myButton: UIButton!
@IBOutlet var tbRouteData: UITableView!
@IBAction func act(sender: UIButton) {
x = !x
getInfo()
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(animated: Bool) {
self.getTmp()
}
func getInfo() -> NSMutableArray {
sharedInstance.database!.open()
var idMeet: Int
if x {
idMeet = 1
} else {
idMeet = 2
}
print(idroute)
let selectInfo: FMResultSet! = sharedInstance.database!.executeQuery("SELECT * FROM t1 AS one JOIN t2 AS two ON (one.id = two.id AND two.line_id = ?) ORDER BY two.position ASC", withArgumentsInArray: [idMeet])
...
return tmp
}
func getTmp(){
infoTmp = NSMutableArray()
infoTmp = getInfo()
}
// MARK: - Table view data source
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return infoTmp.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! PrivateCell
let my:Info = infoTmp.objectAtIndex(indexPath.row) as! Info
cell.listOfStop.text = my.Name.uppercaseString
return cell
}
有在你的代碼 – Sulthan
沒有重裝我問哪裏重載必須 –