xxtmanxx xxtmanxx - 1 year ago 108
Swift Question

Why is the array not showing up in the table view?

I am appending data from parse into an array, but when I try to load array in table view nothing shows up. The array is populated, but nothing is showing up. How do I fix this?

class View2: UIViewController, UITableViewDataSource, UITableViewDelegate{

var ret = [String]()

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

return ret.count

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

let cell = table.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)

cell.textLabel?.text = ret[indexPath.row]

return cell

Answer Source

After set 'ret' value, you have to reload table.

In my case,

var ret = [String](){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download