> On 26 Apr 2015, at 18:29, William Squires <wsqui...@satx.rr.com> wrote: > > I made a fairly simple iOS app (Single View template, iPhone, Swift) that has > a UITableView. I've got it all hooked up, and running the project (in the > simulator) shows the table view, but only 13 (out of 20) rows are ever shown. > > here's the deal: > > ViewController.swift > -------------------- > class ViewController: UIViewController, UITableViewDelegate, UITableViewSource > { > private let dwarves = ["Sleepy", > "Sneezy", > "Bashful", > "Happy," > "Doc", > "Grumpy", > "Dopey", > "Thorin", > "Dorin", > "Nori", > "Ori", > "Balin", > "Dwalin", > "Fili", // From here on, these might as well not exist > (index >= 13) > "Kili", > "Oin", > "Gloin", > "Bifur", > "Bofur", > "Bombur" > ] > let simpleTableIdentifier = "SimpleTableIdentifier" > > ... > > // MARK: UITableViewDataSource/UITableViewDelegate methods > func tableView(tableView: UITableView, numberOfRowsInSection section: Int) > -> Int > { > return dwarves.count > } > > func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath: > NSIndexPath) -> UITableViewCell > { > var cell = > tableView.dequeueReusableCellWithIdentifier(simpleTableIdentifier) as? > UITableViewCell > if (cell == nil) > { > cell = UITableViewCell(style: UITableViewCellStyle.Default, > reuseIdentifier: simpleTableIdentifier) > { > cell!.textLabel?.text = dwarves[indexPath.row] > return cell > } > }
Hazarding a guess you want to check your if statement there. Looks to me like you only ever fill in the cell’s text when creating a new one; not when re-using an existing one. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com