Setting style of UITableViewCell when using iOS 6 UITableView dequeueReusableCellWithIdentifier:forIndexPath:

I know you said you didn’t want to create a subclass, but it looks inevitable. Based on the assembly code while testing in the iOS 6.0 simulator, UITableView creates new instances of UITableViewCell (or its subclasses) by performing [[<RegisteredClass> alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:<ReuseIdentifier>] In other words, the style sent (UITableViewCellStyleDefault) appears to be hard-coded. To get … Read more

Swift: Pass UITableViewCell label to new ViewController

Passing data between two view controllers depends on how view controllers are linked to each other. If they are linked with segue you will need to use performSegueWithIdentifier method and override prepareForSegue method var valueToPass:String! func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) { println(“You selected cell #\(indexPath.row)!”) // Get Cell Label let indexPath = tableView.indexPathForSelectedRow(); let … Read more

Is there a way to make UITableView cells in iOS 7 not have a line break in the separator?

For iOS7: if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { [self.tableView setSeparatorInset:UIEdgeInsetsZero]; } For iOS8: First configure your table view as follows: if ([self.tableView respondsToSelector:@selector(layoutMargins)]) { self.tableView.layoutMargins = UIEdgeInsetsZero; } Then in your cellForRowAtIndexPath: method, configure the cell as follows: if ([cell respondsToSelector:@selector(layoutMargins)]) { cell.layoutMargins = UIEdgeInsetsZero; } Note: Include both layoutMargins and separatorInset, to support both iOS versions

UITableView separator line disappears when selecting cells in iOS7

I haven’t gotten to the bottom of it yet (at first glance it seems like an iOS 7 bug..), but I have found a workaround. In tableView:didSelectRowAtIndexPath, if you send both messages below, the issue is visually resolved (with the probable performance cost). [tableView deselectRowAtIndexPath:indexPath animated:YES]; [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; For this to work (for me), … Read more

UITableView is starting with an offset in iOS 7

The new iOS 7 implementation of UIViewController has a new set of options that allows the developer to choose if the system will automatically add insets for UIScrollView, UITableView and derivations. To disable this behaviour uncheck these boxes for all your wanted UIViewControllers in InterfaceBuilder, on UIViewController selected object inspector: For more details: Submit your … Read more