Questions tagged [uitableview]

UITableView is a class used for displaying and editing lists of information on iOS. A table view displays items in a single column. UITableView is a subclass of UIScrollView, which allows users to scroll through the table, although UITableView allows vertical scrolling only.

UITableView is a class used for displaying and editing hierarchical lists on iOS () and watchOS (). It uses an efficient architecture that reuses existing UITableViewCell objects while they scroll offscreen, improving memory usage and performance during fast scrolling.

Sample of Use

Sample of Use

Resources:

64456 questions
308
votes
12 answers

UIRefreshControl without UITableViewController

Just curious, as it doesn't immediately seem possible, but is there a sneaky way to leverage the new iOS 6 UIRefreshControl class without using a UITableViewController subclass? I often use a UIViewController with a UITableView subview and conform…
Keller
  • 17,051
  • 8
  • 55
  • 72
307
votes
60 answers

-didSelectRowAtIndexPath: not being called

I'm writing an iOS app with a table view inside a tab view. In my UITableViewController, I implemented -tableView:didSelectRowAtIndexPath:, but when I select a row at runtime, the method isn't being called. The table view is being populated though,…
Matt Pfefferle
  • 209
  • 2
  • 6
  • 14
306
votes
23 answers

What is NSLayoutConstraint "UIView-Encapsulated-Layout-Height" and how should I go about forcing it to recalculate cleanly?

I have a UITableView running under iOS 8 and I'm using automatic cell heights from constraints in a storyboard. One of my cells contains a single UITextView and I need it to contract and expand based on user input - tap to shrink/expand the…
Rog
  • 17,070
  • 9
  • 50
  • 73
301
votes
23 answers

How do you load custom UITableViewCells from Xib files?

The question is simple: How do you load custom UITableViewCell from Xib files? Doing so allows you to use Interface Builder to design your cells. The answer apparently is not simple due to memory managment issues. This thread mentions the issue and…
DrGary
  • 3,321
  • 3
  • 20
  • 14
279
votes
39 answers

Hide separator line on one UITableViewCell

I'm customizing a UITableView. I want to hide the line separating on the last cell ... can i do this? I know I can do tableView.separatorStyle = UITableViewCellStyle.None but that would affect all the cells of the tableView. I want it to only affect…
Safari
  • 11,437
  • 24
  • 91
  • 191
270
votes
10 answers

How to disable scrolling in UITableView table when the content fits on the screen

I have a few (grouped style) tables in my iphone app (only on part of the screen and added with Interface Builder though, not subclassed from UITableViewController) that 80% of the time are small and will fit on the screen. When the table fits on…
Ginny
  • 3,111
  • 2
  • 18
  • 12
257
votes
45 answers

Making a UITableView scroll when text field is selected

After a lot of trial and error, I'm giving up and asking the question. I've seen a lot of people with similar problems but can't get all the answers to work right. I have a UITableView which is composed of custom cells. The cells are made of 5 text…
Jonathan
247
votes
4 answers

How to create NSIndexPath for TableView

I need delete row 1 of a table in a function I have defined. In order to use deleteRowAtIndexPath you must use an IndexPath with a section and row defined. How can I create an indexpath like this? An array with the int {1} as its only member will…
Rubber Duck
  • 2,997
  • 2
  • 20
  • 25
246
votes
20 answers

Swipe to Delete and the "More" button (like in Mail app on iOS 7)

How to create a "more" button when user swipe a cell in table view (like mail app in ios 7) I have been looking for this information both here and in the Cocoa Touch forum, but I cannot seem to find the answer and I am hoping someone smarter than…
Guy Kahlon
  • 4,510
  • 4
  • 30
  • 41
244
votes
33 answers

How to add spacing between UITableViewCell

Is there any way to add spacing between UITableViewCell? I have created a table and each cell only contain an image. The image is assigned to the cell like this: cell.imageView.image = [myImages objectAtIndex:indexPath.row]; but this make the image…
saili
  • 2,463
  • 2
  • 15
  • 4
233
votes
23 answers

How to deselect a selected UITableView cell?

I am working on a project on which I have to preselect a particular cell. I can preselect a cell using -willDisplayCell, but I can't deselect it when the user clicks on any other cell. - (void)tableView:(UITableView*)tableView …
Ram
  • 2,503
  • 2
  • 16
  • 14
232
votes
9 answers

Setting custom UITableViewCells height

I am using a custom UITableViewCell which has some labels, buttons and image views to be displayed. There is one label in the cell whose text is a NSString object and the length of string could be variable. Due to this, I cannot set a constant…
Vijayeta
  • 5,585
  • 5
  • 21
  • 11
231
votes
10 answers

Can I force a UITableView to hide the separator between empty cells?

When using a plain-style UITableView with a large enough number of cells that the UITableView cannot display them all without scrolling, no separators appear in the empty space below the cells. If I have only a few cells the empty space below them…
jessecurry
  • 22,068
  • 8
  • 52
  • 44
230
votes
21 answers

UITapGestureRecognizer breaks UITableView didSelectRowAtIndexPath

I have written my own function to scroll text fields up when the keyboard shows up. In order to dismiss the keyboard by tapping away from the text field, I've created a UITapGestureRecognizer that takes care of resigning first responder on the text…
Jason
  • 5,277
  • 4
  • 17
  • 12
219
votes
7 answers

In a storyboard, how do I make a custom cell for use with multiple controllers?

I'm trying to use storyboards in an app I'm working on. In the app there are Lists and Users and each contains a collection of the other (members of a list, lists owned by a user). So, accordingly, I have ListCell and UserCell classes. The goal is…
Cliff W
  • 2,275
  • 3
  • 15
  • 6