Reputation: 10570
this is my code:
class PlayersNamesTableViewController: UITableViewController {
var players = [Player]()
let numberOfPlayers = 30
override func viewDidLoad() {
super.viewDidLoad()
loadPlayers()
}
func loadPlayers(){
for index in 0..<numberOfPlayers{
let player = Player(name: "Player \(index)")
players += [player]
}
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return players.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("playerCellIdentifier", forIndexPath: indexPath) as UITableViewCell
let player = players[indexPath.row]
cell.textLabel?.text = "\(player.name)"
return cell
}
}
in my storyboard, i select Basic
for the style of the cell.
My problem is that the table view is not scrollable, i just can see the first 14 players, like this:
I put print("\(indexPath.row)")
on the override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
method and I can see that there are just 15 values being printed, where are the other 30?
Scroll is enabled on the table view
User Interaction is enabled, as u see here
Upvotes: 0
Views: 1878
Reputation: 1029
Here is your answer. Check your mouse. In simulator you should click to screen and scroll.
Upvotes: 4