Skip to main content

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.

Filter by
Sorted by
Tagged with
1614 votes
29 answers
710k views

Using Auto Layout in UITableView for dynamic cell layouts & variable row heights

How do you use Auto Layout within UITableViewCells in a table view to let each cell's content and subviews determine the row height (itself/automatically), while maintaining smooth scrolling ...
smileyborg's user avatar
  • 30.4k
1277 votes
42 answers
543k views

How can I disable the UITableView selection?

When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
davidmytton's user avatar
  • 39.1k
771 votes
34 answers
200k views

Eliminate extra separators below UITableView

When I set up a table view with 4 rows, there are still extra separators lines (or extra blank cells) below the filled rows. How would I remove these cells?
RoundOutTooSoon's user avatar
732 votes
78 answers
327k views

Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7

Starting in iOS7, there is additional space at the top of my UITableView's which have a style UITableViewStyleGrouped. Here is an example: The tableview starts at the first arrow, there are 35 pixels ...
esilver's user avatar
  • 28.2k
686 votes
43 answers
188k views

iOS 8 UITableView separator inset 0 not working

I have an app where the UITableView's separator inset is set to custom values - Right 0, Left 0. This works perfectly in iOS 7.x, however in iOS 8.0 I see that the separator inset is set to the ...
user3570727's user avatar
  • 10.2k
582 votes
19 answers
295k views

UITableViewCell, show delete button on swipe

How do I get the delete button to show when swiping on a UITableViewCell? The event is never raised and the delete button never appears.
TheLearner's user avatar
  • 19.5k
420 votes
37 answers
283k views

UITableView - scroll to the top

In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section number 5. So I get an ...
Ilya Suzdalnitski's user avatar
406 votes
21 answers
140k views

Can you animate a height change on a UITableViewCell when selected?

I'm using a UITableView in my iPhone app, and I have a list of people that belong to a group. I would like it so that when the user clicks on a particular person (thus selecting the cell), the cell ...
user avatar
371 votes
10 answers
158k views

How to remove empty cells in UITableView? [duplicate]

i am trying to display a simple UITableView with some data. I wish to set the static height of the UITableView so that it doesn't displays empty cells at the end of the table. how do I do that? code: ...
z22's user avatar
  • 10.1k
360 votes
10 answers
357k views

How to pass prepareForSegue: an object

I have many annotations in a mapview (with rightCalloutAccessory buttons). The button will perform a segue from this mapview to a tableview. I want to pass the tableview a different object (that ...
chizzle's user avatar
  • 4,142
357 votes
16 answers
61k views

UITableView didSelectRowAtIndexPath: not being called on first tap

I'm having an issue with UITableView's didSelectRowAtIndexPath. My table is setup so that when I select row it initializes a new view controller and pushes it. The first time I tap any row in the ...
Mark Adams's user avatar
  • 30.8k
352 votes
34 answers
280k views

UITableView - change section header color

How can I change color of a section header in UITableView? EDIT: The answer provided by DJ-S should be considered for iOS 6 and above. The accepted answer is out of date.
Ilya Suzdalnitski's user avatar
345 votes
34 answers
378k views

UITableView Cell selected Color?

I have created a custom UITableViewCell. The table view is showing data fine. What I am stuck in is when user touches cell of tableview, then I want to show the background color of the cell other than ...
Mc.Lover's user avatar
  • 4,942
326 votes
22 answers
183k views

Assertion failure in dequeueReusableCellWithIdentifier:forIndexPath:

So I was making an rss reader for my school and finished the code. I ran the test and it gave me that error. Here is the code it's referring to: - (UITableViewCell *)tableView:(UITableView *)...
Nick Scottman's user avatar
317 votes
23 answers
245k views

UITableview: How to Disable Selection for Some Rows but Not Others

I am displaying in a group tableview contents parsed from XML. I want to disable the click event on it (I should not be able to click it at all) The table contains two groups. I want to disable ...
Warrior's user avatar
  • 39.3k
311 votes
23 answers
117k views

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 ...
Rog's user avatar
  • 17.2k
308 votes
60 answers
226k views

-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 ...
307 votes
12 answers
84k views

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 ...
Keller's user avatar
  • 17.1k
301 votes
23 answers
221k views

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 ...
DrGary's user avatar
  • 3,321
283 votes
39 answers
294k views

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 ...
Safari's user avatar
  • 11.7k
270 votes
10 answers
188k views

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 ...
Ginny's user avatar
  • 3,111
258 votes
45 answers
211k views

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 ...
249 votes
4 answers
205k views

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? ...
Rubber Duck's user avatar
  • 3,037
249 votes
32 answers
394k views

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 ...
saili's user avatar
  • 2,513
246 votes
20 answers
132k views

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 ...
Guy Kahlon's user avatar
  • 4,520
234 votes
23 answers
219k views

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)...
Ram's user avatar
  • 2,513
233 votes
9 answers
286k views

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 ...
Vijayeta's user avatar
  • 5,635
231 votes
21 answers
89k views

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 ...
Jason's user avatar
  • 5,307
231 votes
10 answers
131k views

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

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 ...
jessecurry's user avatar
  • 22.1k
219 votes
25 answers
178k views

Resizing UITableView to fit content

I am creating an app which will have a question in a UILabel and a multiple choice answers displayed in UITableView, each row showing a multiple choice. Questions and answers will vary, so I need this ...
MiMo's user avatar
  • 4,965
219 votes
19 answers
156k views

How can I tell when UITableView has completed ReloadData?

I am trying to scroll to the bottom of a UITableView after it is done performing [self.tableView reloadData]. I originally had [self.tableView reloadData] NSIndexPath* indexPath = [NSIndexPath ...
Alan's user avatar
  • 9,421
219 votes
7 answers
82k views

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 ...
Cliff W's user avatar
  • 2,275
217 votes
26 answers
137k views

Detecting which UIButton was pressed in a UITableView

I have a UITableView with 5 UITableViewCells. Each cell contains a UIButton which is set up as follows: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)...
rein's user avatar
  • 33.3k
214 votes
2 answers
108k views

How to fix UITableView separator on iOS 7? [duplicate]

UITableView draws with ragged lines on iOS 7: How to fix it? The line between cells should be on the full width of the screen.
Dmitry's user avatar
  • 14.6k
213 votes
18 answers
115k views

Custom Cell Row Height setting in storyboard is not responding

I am trying to adjust the cell height for one of the cells on my table view. I am adjusting the size from the "row height" setting inside the "size inspector" of the cell in question. When I run the ...
zirinisp's user avatar
  • 10.1k
198 votes
11 answers
109k views

Long press on UITableView

I would like to handle a long press on a UITableViewCell to print a "quick access menu". Did someone already do this? Particularly the gesture recognize on UITableView?
foOg's user avatar
  • 3,146
193 votes
3 answers
98k views

Table Header Views in StoryBoards

Is there a way to insert a Table Header View (tableHeaderView) in StoryBoard (like we used to do in Interface Builder)?
Tyler DeWitt's user avatar
  • 23.5k
191 votes
18 answers
197k views

How to customize the background color of a UITableViewCell?

I would like to customize the background (and maybe the border too) of all of the UITableViewCells within my UITableView. So far I have not been able to customize this stuff, so I have a bunch of ...
jpm's user avatar
  • 16.7k
189 votes
9 answers
163k views

Is it possible to refresh a single UITableViewCell in a UITableView?

I have a custom UITableView using UITableViewCells. Each UITableViewCell has 2 buttons. Clicking these buttons will change an image in a UIImageView within the cell. Is it possible to refresh each ...
Wizard Of iOS's user avatar
186 votes
8 answers
149k views

Class has no initializers Swift

I have a problem with Swift class. I have a swift file for UITableViewController class and UITableViewCell class. My problem is the UITableViewCell class, and outlets. This class has an error Class "...
Kevin Py's user avatar
  • 2,468
180 votes
16 answers
154k views

How to Implement Custom Table View Section Headers and Footers with Storyboard

Without using a storyboard we could simply drag a UIView onto the canvas, lay it out and then set it in the tableView:viewForHeaderInSection or tableView:viewForFooterInSection delegate methods. How ...
Seamus's user avatar
  • 3,191
180 votes
6 answers
80k views

Pull to refresh UITableView without UITableViewController

I'm trying to implement a pull to refresh feature in a UITableView within a UIViewController. I can't use a UITableViewController because I want the UITableView to be a smaller subview in the view ...
Daniel Robinson's user avatar
180 votes
12 answers
165k views

Having a UITextField in a UITableViewCell

I'm trying to do that for a couple of days now, and after reading tons of messages of people trying to do that too, I'm still unable to have a fully working UITextField in some of my UITableViewCells, ...
Mathieu's user avatar
  • 1,984
178 votes
32 answers
121k views

Remove empty space before cells in UITableView

I am currently trying to put a UITableView in a different location rather than at the top of my view controller. With this said, it is trying to add the header in the top to account for the navigation ...
hetelek's user avatar
  • 3,866
177 votes
20 answers
58k views

UITableViewCell subview disappears when cell is selected

I'm implementing a color-chooser table view where the user can select amongst, say, 10 colors (depends on the product). The user can also select other options (like hard drive capacity, ...). All ...
Cyrille's user avatar
  • 25.1k
171 votes
6 answers
136k views

UITableView, Separator color where to set?

I have added a UITableView in IB and set the "delegate" and "datasource" and all is working well. What I wanted to do next was change the separator color, but the only way I could find to do this was ...
fuzzygoat's user avatar
  • 26.2k
169 votes
24 answers
157k views

Add swipe to delete UITableViewCell

I am making a CheckList application with a UITableView. I was wondering how to add a swipe to delete a UITableViewCell. This is my ViewController.swift: import UIKit class ViewController: ...
jdnoon's user avatar
  • 1,879
169 votes
8 answers
63k views

What is the default height of UITableViewCell?

I thought this information would have been easier to find :-) What is the default height of a UITableViewCell? It looks like 44 pixels, but I'd prefer to be sure.
Rob's user avatar
  • 26.2k
169 votes
5 answers
232k views

Adding iOS UITableView HeaderView (not section header)

I want to add a table header (not section headers) like in the contacts app for example: exactly like that - a label beside an image above of the table. I want the all view be scrollable so I can't ...
AMM's user avatar
  • 2,195
166 votes
16 answers
96k views

How to set the full width of separator in UITableView

I have a UITableView where the separators don't have the full width. It ends like 10 pixels before the left side. I was playing around with this code in the viewDidLoad(). self.tableView....
Timo Cengiz's user avatar
  • 3,407

1
2 3 4 5
1289