ios7 UITableViewCell selectionStyle won’t go back to blue

There is only one selectionStyle in iOS7, to change you need to do this manually like below: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { …. UIView *bgColorView = [[UIView alloc] init]; bgColorView.backgroundColor = [UIColor colorWithRed:(76.0/255.0) green:(161.0/255.0) blue:(255.0/255.0) alpha:1.0]; // perfect color suggested by @mohamadHafez bgColorView.layer.masksToBounds = YES; cell.selectedBackgroundView = bgColorView; …. return cell; }

UITableView layout messing up on push segue and return. (iOS 8, Xcode beta 5, Swift)

This bug is caused by having no tableView:estimatedHeightForRowAtIndexPath: method. It’s an optional part of the UITableViewDelegate protocol. This isn’t how it’s supposed to work. Apple’s documentation says: Providing an estimate the height of rows can improve the user experience when loading the table view. If the table contains variable height rows, it might be expensive … Read more

How do I adjust my popover to the size of the content in my tableview in swift?

In your UITableViewController’s viewDidLoad() you can add an observer: self.tableView.addObserver(self, forKeyPath: “contentSize”, options: .new, context: nil) Then add this method: override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { self.preferredContentSize = tableView.contentSize } Lastly, in viewDidDisappear(), make sure you remove the observer: tableView.removeObserver(self, forKeyPath: “contentSize”) This way the popover … Read more

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 in Swift

Also see matt’s answer which contains the second half of the solution Let’s find a solution without creating custom subclasses or nibs The real problem is in the fact that Swift distinguishes between objects that can be empty (nil) and objects that can’t be empty. If you don’t register a nib for your identifier, then … Read more

tech