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
0
votes
2 answers

iOS table view cell doesn't show expected behaviour

Yesterday I asked a question about a cell not showing correctly a button that depends on a string value. Please take a look at it if you want: Strange behaviour on table view with core data. User @jrturton pointed out following as part of his…
mvasco
  • 4,965
  • 7
  • 59
  • 120
0
votes
1 answer

Datas in tableviewcell are repeating

REFeveItinerarioCell *cell = nil; cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NSDictionary *itemData = [self.tableDatawithcoordinate objectAtIndex:indexPath.row]; if(cell==nil) { …
santa
  • 147
  • 1
  • 4
  • 16
0
votes
0 answers

Appropiate way of managing fixed cells in a table view

I have a grouped-style UITableView intended to show a fixed number of sections, each of one having in turn a fixed set of cells, similarly to Settings app. Some of the cells are custom and different between them: some of them have a textfield,…
AppsDev
  • 12,319
  • 23
  • 93
  • 186
0
votes
1 answer

Change in content of one cell changes other cells as well in UITableView

I have created a custom cell and added a uibutton on it. On tap of that button, Im setting that button selected which changes button's image. -(IBAction)btnInfoPressed:(id)sender { [btnInfo setSelected:YES]; } The above method is in the custom…
iAmd
  • 812
  • 1
  • 12
  • 22
0
votes
2 answers

Enforce typing on string keys/IDs

In a generic OO language (say C++, C#, java) I have a map of objects with a string ID and the same ID is also key of the relative object class Foo(){ Foo(string id){this.id = id;} string id; string otherProperty; } map
jalone
  • 1,953
  • 4
  • 27
  • 46
0
votes
2 answers

Truly copy UITableViewCell

I'm trying to drag & drop a customCell from a tableView. I'm using an UIImageView that gets the image of the customCell and then drag it around the view but the problem is that I can't get the image of the customCell. CustomCellClass *customCell =…
lopes710
  • 315
  • 1
  • 3
  • 19
0
votes
2 answers

Why does my tableview crash on identifier?

I created a tableviewcontroller to handle 4 static cells in a tableview. The tableview is positioned right below the 4 cells. However the last cell, 4th cell, is optional based on the 3rd cell's result. The picker returns a value and when it…
marciokoko
  • 4,988
  • 8
  • 51
  • 91
0
votes
2 answers

UITableViewCells and NSURLConnection

I have a custom UITableViewCell, and when the user clicks a button i make a request to a server and update the cell. I do this with a NSUrlConnection and it all works fine (this is all done inside the cell class) and once it returns it fires a…
0
votes
1 answer

Custom Cell re-use in iOS 5.1

I'm having a hard time understanding the following block of code inside cellForRowAtIndexPath: NSString *uniqueIdentifier = @"SliderCellWithComments"; SliderCellWithComment *cell = nil; cell = (SliderCellWithComment*) [tableView…
Matthys Du Toit
  • 2,168
  • 3
  • 21
  • 34
0
votes
1 answer

two row's are marked by one tap in UITableView selection list

i'm trying to do a selection list in UITableView but whenever i tap in a row, two row are marked. For example if i tap the first row it adds a checkmark to row = 0 and row = 11. I think the problem is caused by reuse of cells but i don't understand…
Manuel Ragazzini
  • 919
  • 1
  • 10
  • 24
0
votes
1 answer

How to customize a UITableViewCell without any freezing in UITableView

I have customized the table view cell, created nib file and its corresponding .h and .m file. Everything works fine except slowness while scrolling, what could be the problem how can I avoid the freezing? And obj = [self.listData objectAtIndex:…
Newbee
  • 3,231
  • 7
  • 42
  • 74
0
votes
1 answer

UITableView Creating Static Cells in Dynamic Environment

I have a UITableView that is currently set up to be dynamic as the cells change based on the users input. Some of the cells have Text Fields, others have switches and others have segment selectors. I am not really sure where to start here. Here is…
CoreCode
  • 2,227
  • 4
  • 22
  • 24
0
votes
1 answer

custom UITable cell how to build with unique included object state?

So I has custom table cell defined via builder and loaded via nib (and it has a property of its idexPath) and it has 2 buttons. I want to show table with dynamically changed state of those buttons. IE 1st cell - both enabled, 2nd cell - both buttons…
Stan
  • 6,511
  • 8
  • 55
  • 87
0
votes
1 answer

Cell Reusable causes reapeating data in iOS5

I am using custom cell for my table view. In my cell , I have imageview & button. I am displaying 3 images in single row. When I select button , I am using checkbox image & when again tap on button , it deselect the checkbox image.When I select the…
iOSAppDev
  • 2,755
  • 4
  • 39
  • 77
0
votes
1 answer

Custom UITableViewCell not dequeuing properly

I have a UITableView with 3 custom UITableViewCells that I'm currently dequeuing like so: if (indexPath.row == 0) { static NSString *CellIdentifier = @"MyCell1"; MyCell *cell = [tableView…
VTS12
  • 452
  • 8
  • 22
1 2 3
10
11