Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift UITableView separator not visible

I'm new in ios/swft and faced with problem showing separator in table view. I've spent already few days tried out almost all suggestions none of them works for me. I'm inserting cells dynamically and in this case separator disappears. Below the code I'm using.

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    @IBOutlet weak var tableView: UITableView!

    let tableData = ["One","Two","Three"]


    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        tableView.delegate = self
        tableView.dataSource = self
    }


    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tableData.count
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell")!

        cell.textLabel?.text = tableData[indexPath.row]
        return cell
    }

}

On a storyboard it is simple tableview on a view, nothing special.

This is really annoying me, please help to fix it.

like image 373
mihatel Avatar asked Feb 02 '16 10:02

mihatel


1 Answers

It turned out that issue is only on the simulator, not on an actual device.

like image 58
mihatel Avatar answered Nov 15 '22 11:11

mihatel