Ios cellForRowAtIndexPath中的dequeueReusableCellWithIdentifier中的单元格在滚动之前不显示
我有下面的函数来填充tableview。我正在制作一个数组,获取文本和图像以显示在单元格中。加载该信息时,单元格应显示。但是,单元格在我滚动之前不会显示。问题是什么?如何解决?我看过其他问题,但他们似乎无法回答我的问题,或者我只是不明白他们在说什么Ios cellForRowAtIndexPath中的dequeueReusableCellWithIdentifier中的单元格在滚动之前不显示,ios,swift,uitableview,Ios,Swift,Uitableview,我有下面的函数来填充tableview。我正在制作一个数组,获取文本和图像以显示在单元格中。加载该信息时,单元格应显示。但是,单元格在我滚动之前不会显示。问题是什么?如何解决?我看过其他问题,但他们似乎无法回答我的问题,或者我只是不明白他们在说什么 override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! PreviousSongCell
var song : PreviousSong
song = self.previousSongs[indexPath.row]
if (song.artist != "") {
tableView.userInteractionEnabled = true
cell.song.text = song.song
cell.artist.text = "by " + song.artist
cell.time.text = song.time
cell.art.image = song.art
cell.backgroundColor = UIColor.grayColor()
cell.alpha = 0
UIView.animateWithDuration(0.15, animations: { cell.alpha = 1 })
}
return cell
}
加载数据后调用此选项:
dispatch_async(dispatch_get_main_queue()) {
self.tableView.reloadData()
}
加载数据后调用此选项:
dispatch_async(dispatch_get_main_queue()) {
self.tableView.reloadData()
}
第一次显示时是否调用此函数?第一次显示时是否调用此函数?