Questions tagged [reuseidentifier]

In the Cocoa Touch platform, reuse identifiers are string values, supplied by the programmer, that define pools of similar view objects in for use with UITableView, UICollectionView, or MKMapView.

Great iOS apps must perform well in memory– and processor-constrained environments while displaying rich, high resolution content. Reuse identifiers are part of a caching mechanism employed by a few of the core data views provided by Apple to minimize the number of views to initially construct, based on the data currently visible in a scrolling view, without requiring constant reconstruction of views as the user scrolls or pans through data.

The following view classes employ reuse identifiers:

The programmer first identifies the class of the view to use for a given reuse identifier. This can be done in a few ways:

  • By configuring prototype cell views with reuse identifiers and class names in a storyboard
  • By mapping reuse identifiers to classes or nibs in methods such as registerClass:forReuseIdentifier:
  • By manually instantiating new cell or annotation objects with a given reuse identifier value

When the table/collection/map view displays the initial set of data, or it displays new data due to user interaction, it will ask its delegate to create views for each item to display. The delegate will typically use a "dequeue" method such as dequeueReusableCellWithIdentifier: to get an instance of the right type of view, then customize the view for the specific data to display, and return that view. If there is an existing view object with the given reuse identifier that is not currently visible on screen, it may be returned from the "dequeue" method so that it can be reused; otherwise, a new view object will be created with the given reuse identifier.

152 questions
1
vote
1 answer

Generic UITableViewCell Identifier

I try to use types and enum instead of string for the cellIdentifier I don't want to use the cell class name as identifier since I can have multiple Identifiers for one type cell (for example the basic cell in different tableviews) enum…
zarghol
  • 478
  • 5
  • 19
1
vote
0 answers

Embed UITableView in a UICollectionViewCell

I have a vertical UICollection view. One of it cells has a table view. The table view size has it content size, this means there is no scrolling for table view. The problem is once the collection view cell that has the table view being displayed,…
1
vote
0 answers

Cant display UI elements from didSelectItemAt indexPath

Ive gone and set up a collectionview inside another collectionview and for the most part it seems to be working ok. But there is a bit of a glitch with trying to display or edit UI elements from various parts of my code. In cellForItemAt i can…
Pippo
  • 1,439
  • 1
  • 18
  • 35
1
vote
1 answer

Interview Que Tableview reuseIdentifier Internal working

If I have 500 records to show in UITableview and We implemented with reuseIdentifier in cellforRowAtIndexPath and at a time 4 records(Cell) are visible and as I know 4 cells view will be loaded and it will be reused when scroll. And the condition is…
Arvind Kumar
  • 2,371
  • 1
  • 18
  • 25
1
vote
1 answer

How do use different cell styles in a UITableView

I'm creating a view for accessing settings in an app which will be presented in a UITableView. Some cells will have a UITableViewCellAccessoryDisclosureIndicator, I need one with a UISwitch, and another with a UISegmentedControl sort of like this: …
Jim
  • 1,260
  • 15
  • 37
1
vote
1 answer

What are the exact circumstances in which I can reuse a UITableViewCell?

What are the exact circumstances in which I can reuse a cell (using dequeueReusableCellWithIdentifier in the UITableView class)?
Casebash
  • 114,675
  • 90
  • 247
  • 350
1
vote
1 answer

How do I force a refresh of reused collectionview cells?

THE PROBLEM I using multiple UICollectionViews that each occupy a cell in a UITableView, as per the image below: Each Table View Cell contains a CollectionView that creates cells via dequeueReusableCellWithReuseIdentifier with the same nib…
Rob d'Apice
  • 2,416
  • 1
  • 19
  • 29
1
vote
5 answers

TableView cell reuse causing the button title to change while scrolling

I am having a list displaying a name and a button titled as "Follow". When I tap on the button title should change to "UnFollow". If I tap on the button again the title should again change to "Follow". This is working fine, but when I am scrolling…
Shikhar varshney
  • 816
  • 1
  • 9
  • 23
1
vote
3 answers

Cell's progress bar duplicates on other cells

I have a cell reuse problem. All my cells are identical, there is only one section. Cells include a label, button and progress bar. The button triggers a sound (it's a simple "play" button). When the AVAudioPlayers delegate method is called,…
Gil Sand
  • 5,802
  • 5
  • 36
  • 78
1
vote
1 answer

Displaying two different annotation images

I would like to show 2 different types of annotations based on a specific 'chain' variable... How could I go about doing so? This is a code snippet I have now: pinView = [[MKAnnotationView alloc] initWithAnnotation:annotation …
Jenel Ejercito Myers
  • 2,553
  • 2
  • 16
  • 24
1
vote
2 answers

XCode Reusing UITableViewCells in Storyboard

I have a UITableViewCell in my project that I want to reuse in a few UITableViews. Is there a way to reuse them without setting up UILabels, etc each time in the Storyboard?
Brian Kalski
  • 897
  • 9
  • 35
1
vote
0 answers

Swift UITableviewcell without reuse

I create a tableView inside a tableView inside another tableView. The problem is that when the cell is reused, the tableView inside another tableView is corrupted I usually get that error Invalid update: invalid number of rows in section 0. The…
Armanoide
  • 1,248
  • 15
  • 31
1
vote
3 answers

UITableviewCell display text for another cell when I scroll

When I scroll my custom UITableviewCells get wrong content (another cell's text). This happens randomly. I tried clearing the cell but then I get some blanks cell. My code is below. Can anyone tell me what is happening. I have read many…
Hassan Hussein
  • 157
  • 1
  • 11
1
vote
4 answers

Registered NIB, still getting assertion error when I use dequeueReusableCellWithIdentifier

I have a custom UITableViewCell class that I want to use to create custom table cells. I created the custom table cell's xib as well as its header and implementation files, all called RTRepairOrderTableCell.m/.h/.xib. My issue is that even though I…
Giardino
  • 1,367
  • 3
  • 10
  • 30
1
vote
0 answers

MPMoviePlayerController reuse in a custom UITableViewCell

I am working on creating a table where each cell has a play button and a MPMoviePlayerController. It is setup so that I have custom UITableViewCell class that loads a .xib. Just to make sure the cells are being reused correctly, I have the tableView…
George L
  • 1,673
  • 2
  • 26
  • 39