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
148
votes
4 answers

How to resize superview to fit all subviews with autolayout?

My understanding of autolayout is that it takes the size of superview and base on constrains and intrinsic sizes it calculates positions of subviews. Is there a way to reverse this process? I want to resize superview on the base of constrains and…
DAK
  • 1,505
  • 3
  • 11
  • 5
147
votes
35 answers

How to scroll to the bottom of a UITableView on the iPhone before the view appears

I have a UITableView that is populated with cells of a variable height. I would like the table to scroll to the bottom when the view is pushed into view. I currently have the following function NSIndexPath *indexPath = [NSIndexPath…
acqu13sce
  • 3,789
  • 4
  • 25
  • 32
147
votes
24 answers

Handling an empty UITableView. Print a friendly message

I have a UITableView that in some cases it is legal to be empty. So instead of showing the background image of the app, I would prefer to print a friendly message in the screen, such as: This list is now empty What is the simplest way to do it?
cateof
  • 6,608
  • 25
  • 79
  • 153
146
votes
11 answers

Reducing the space between sections of the UITableView

Is there a way to reduce the space between two sections of a UITableView? There are about 15 pixels between every single section I have. I did already try to return 0 for -tableView:heightForFooterInSection: and -tableView:heightForHeaderInSection:…
flohei
  • 5,248
  • 10
  • 36
  • 61
146
votes
18 answers

Get button click inside UITableViewCell

I have a view controller with a table view and a separate nib for the table cell template. The cell template has some buttons. I want to access the button click along with the index of the cell clicked inside the view controller where I have defined…
ankit_rck
  • 1,796
  • 2
  • 14
  • 24
146
votes
24 answers

Customize UITableView header section

I want to customize UITableView header for each section. So far, I've implemented -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section this UITabelViewDelegate method. What I want to do is to get current header…
limon
  • 3,222
  • 5
  • 35
  • 52
145
votes
8 answers

Hide keyboard when scroll UITableView

In my app i want hide keyboard when i start scrolling UITableView. I search about this in internet, and most answer is subclassing UITableView (http://stackoverflow.com/questions/3499810/tapping-a-uiscrollview-to-hide-the-keyboard). I made subclass…
olegi
  • 2,051
  • 3
  • 16
  • 9
145
votes
16 answers

UICollectionView inside a UITableViewCell -- dynamic height?

One of our application screens requires us to place a UICollectionView inside of a UITableViewCell. This UICollectionView will have a dynamic number of items, resulting in a height which must be calculated dynamically as well. However, I am…
Shadowman
  • 11,150
  • 19
  • 100
  • 198
141
votes
10 answers

Using a custom image for a UITableViewCell's accessoryView and having it respond to UITableViewDelegate

I'm using a custom drawn UITableViewCell, including the same for the cell's accessoryView. My setup for the accessoryView happens by the way of something like this: UIImage *accessoryImage = [UIImage…
anon
141
votes
23 answers

Detected a case where constraints ambiguously suggest a height of zero

After updating to Xcode 6.1 beta 2 when I run my app that contains tableview cells, the debug assistant says: Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're…
David E
  • 1,523
  • 2
  • 10
  • 7
141
votes
7 answers

Select tableview row programmatically

How do I programmatically select a UITableView row so that - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath gets executed? selectRowAtIndexPath will only highlight the row.
4thSpace
  • 43,672
  • 97
  • 296
  • 475
139
votes
12 answers

How to change the blue highlight color of a UITableViewCell?

I'm wondering how to change the blue highlight/selection color of a UITableViewCell, any ideas?
Thomas Joos
  • 2,451
  • 5
  • 26
  • 30
135
votes
22 answers

UITableView set to static cells. Is it possible to hide some of the cells programmatically?

UITableView set to static cells. Is it possible to hide some of the cells programmatically?
Shmidt
  • 16,436
  • 18
  • 88
  • 136
132
votes
30 answers

UITableView dynamic cell heights only correct after some scrolling

I have a UITableView with a custom UITableViewCell defined in a storyboard using auto layout. The cell has several multiline UILabels. The UITableView appears to properly calculate cell heights, but for the first few cells that height isn't properly…
blackp
  • 1,752
  • 3
  • 13
  • 14
132
votes
16 answers

UITableView : viewForHeaderInSection: not called during reloadData:

I've set up the tableview with correct delegate and datasource linkages.. the reloadData method calls the datasource and the delegate methods except for viewForHeaderInSection:. Why is that so?
inforeqd
  • 3,209
  • 6
  • 32
  • 46