Telember
Telember

Reputation: 465

UITableView show some row

I have a problem with UITableView in UIViewController.My table shows some row that I don't know why. It should be show all of row.

simulator Prototype

class TableViewController: UIViewController,UITableViewDelegate, UITableViewDataSource  {
    let cellIdentifier = "testCell"

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

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

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! TableViewCell
        cell.lableName.text = "Hello man"

    return cell
    }
}

Upvotes: 0

Views: 104

Answers (2)

Suric
Suric

Reputation: 131

Please check your tableview delegate and datasource. BTW,set right constraints.

Upvotes: 0

Jack.Right
Jack.Right

Reputation: 994

if you want hello man in 20 row.(All row)in cell for row at index path method add this line

cell.labelname.text = "Hello Man"

Upvotes: 1

Related Questions