Since Updating to xcode 12 I am not able to place any UIControl inside UITableViewCell
Your code was always wrong: cell.addSubview(textField) You must never add a subview to a cell. Add the subview to the cell’s contentView.
Your code was always wrong: cell.addSubview(textField) You must never add a subview to a cell. Add the subview to the cell’s contentView.
I fixed this by finding the delete button view and bringing it to the front. I did this in layoutSubviews in a UITableViewCell subclass. Here’s a small bit of code that should give you an idea of how to do it: – (void)layoutSubviews { [super layoutSubviews]; for (UIView *subview in self.subviews) { for (UIView *subview2 … Read more
I believe there won’t be any simple solution to this problem. May be someone could write a separate library to implement this behaviour plus it will cause more complications once you cache data in tableview. But let us break down the problem and that might help you in achieving what you want. I have used … Read more
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
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
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
cell reusing can be tricky but you have to keep 2 things in mind: Use one identifier for one type of cell – Using multiple identifiers is really only needed when you use different UITableViewCell-subclasses in one table view and you have to rely on their different behaviour for different cells The cell you reuse … Read more
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
So I think the underlying issue is a kind of chicken and egg problem. In order to ‘aspect fit’ the image to the UIImageView the system needs a size for the view, and yet we would like the height of the view to be determined after aspect fitting the image given a known width for … Read more
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