Tag: uitableview

iOS9 – UITableViewCellContentView is covering up Controls inside Cell

I have made a custom UITableViewCell called “SwitchCell” that has a switch. In iOS9 Only, using Xcode 7 beta, the Content view in the cell is on top of the switch. (See screenshot of View Hierarchy. You can clearly see that the content view of the cell is on top of the other views. ): […]

How To Replace UITableView With Image?

I have a UITableView that is blank be default until the user edits and adds data to it. I want to show an image with instructions that is shown until the user edits it. The size of the picture is so it fits under perfectly between the nav bar and the tab bar. Is there […]

Lazy load images for UITableViewCells from NSDocumentDirectory?

I have a UITableView in my app in which I load several images from the NSDocumentDirectory. It works, but when scrolling up and down, the app seems to freeze a bit, most likely because of the images being served in the main thread, effectively blocking the tableView from scrolling until it’s loaded. My problem is […]

iPhone UITableView image background when table is empty

I would like to show an image background when my UITableView is empty. Currently I tried adding a UIImageView to my view controller that contains a table, but XCode doesn’t allow it. Is there a good way of doing it?

What methods do I have to implement in order to re-arrange the UITableView rows?

For a simple example of using a NSMutableArray of strings called rows, what do I have to implement in my table controller to move the tableView rows and have the changes reflected in my array?

How to recreate the default UIView the same as the default tableView:viewForHeaderInSection:?

I tried to implement the – (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section to get the text label of the header in section of black color instead of the white color, but it looks so different from the default one created by the SDK, mine is so ugly. How to recreate the UIView with exactly the same as […]

How to add a navigation controller to a view-based application?

Is it possible to add a UINavigationController to a view application that inherits from UIViewController and not UITableViewController? How is it done?

Add button to UITableViewCell

I want to add a button in a UITableViewCell. This is my code: ` if (indexPath.row==2) { UIButton *scanQRCodeButton = [[UIButton alloc]init]; scanQRCodeButton.frame = CGRectMake(0.0f, 5.0f, 320.0f, 44.0f); scanQRCodeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; scanQRCodeButton.backgroundColor = [UIColor redColor]; [scanQRCodeButton setTitle:@”Hello” forState:UIControlStateNormal]; [cell addSubview:scanQRCodeButton]; }` Now, when I run the app, I see only a blank row ! […]

How to delete a row in UITableView manually?

Here’s what I’ve come up with: NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:1]; // my table view has 2 sections [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationTop]; Everytime I build and run, it throws the following exception: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update must […]

How to unselect a UITableViewCell after you have done some action using didSelectRowAtIndexPath?

Currently I do some work inside the didSelectRowAtIndexPath delegate and noticed that my row is still “selected” after I come back to the view controller later. How can I unselect this row inside the delegate itself? – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //do logic and … it remains selected in the view? }