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

How to reuse correctly the cells in Objective c?

I have a big problem with my UITableViewCell. I use storyboard and I have a custom cell into my UITableVIew. I add a Identifier to this, and my class code is: static NSString *celldentifier = @"myCellId"; CustomCell *myCell = [tableView…
user3745888
  • 6,143
  • 15
  • 48
  • 97
0
votes
2 answers

Collection View Cell behaving abnormally

I have a cell in which i have two labels on the top, then a view in the middle and two labels on bottom, its a graph. I have hard-coded the number of items as i only need 10-13 values, apparently everything is fine and the values are being updated…
0
votes
3 answers

Textfields in custom tableviewcell goes out of cell while scrolling

I am working on an application where i am using a UITableview with custom tableviewcell on XIB. My problem is, I have placed textfield on tableviewcell through xib. I am accesing this custom cell in my viewcontroller class which is having a…
Muju
  • 884
  • 20
  • 54
0
votes
4 answers

How can I control my cells according to reuseIdentifier?

I created two different cells to show different data in them. And I assigned reuseIdentifier ("TableCell" and "FixtureCell") to them. They have two different classes named FixtureTableViewCell and LeagueTableViewCell I want to do that if the cell…
0
votes
1 answer

UICollectionview is not working, I am not getting any Cell

I am trying to use a collection view and reuse a collection view cell and I have to get 23 images and name from server which I have not started coz of the problem I am facing This is my custom cell file collection view file objective c Below is my…
Akshay
  • 179
  • 1
  • 16
0
votes
3 answers

text in UITableViewCell get remove when user scroll uitableview

I am working on the project which have lots of forms(like sign up forms)approx 20-25forms are there and each forms have 8-9 input box i.e textfields. 1) I have created custom UITableViewCell 2) I cell for row at index i Wrote below code…
0
votes
1 answer

ios data is removed when uitableview scroll

I have customized uitableviewcell, which has two uitextfields. I have inputted some data into cells. However, the data is removed when I scroll down the tableview. I know this happens due to the cell is recreated. How can I keep those inputted…
0
votes
0 answers

View based NSTableView having Sluggish Scrolling

I am using View based NSTableView where I have around 30 columns and rows could be in between 200 - 1000. The problem is that the tableView is very sluggish. After doing some debugging, I figured out that adding an identifier to NSTableCellView made…
Rahul Singh
  • 1,219
  • 3
  • 13
  • 36
0
votes
4 answers

How to create inconsistent number of labels in UITableView custom cell?

I want to create a custom cell with number of labels in it. It is easy to create custom cell if you know the number of fixed labels required. But what if you don't know how many labels are needed for a particular cell. I get values from API side…
Hiren Prajapati
  • 717
  • 3
  • 10
  • 25
0
votes
1 answer

Reuse Identifier on iCarousel

I am trying to build a carousel on my app based on this project, https://github.com/nicklockwood/iCarousel, only I am writing it in swift. I have it working correctly, where you can scroll through and tap on the item at index correctly here: func…
user3255746
  • 1,377
  • 3
  • 12
  • 13
0
votes
1 answer

Adding values to each row in Swift but not when row is dequeued & reused

I'm getting info from a GPS service giving an array of addresses, each one containing a duration of time in seconds. So from point A to Point B the time duration is 250 seconds and from Point B to C 100 seconds. It does not add the times together to…
Chaim Friedman
  • 720
  • 6
  • 24
0
votes
2 answers

UITableViewCell reusability issue. Modifying one cell is affecting others

Whenever a cell from section 3 is selected. I'm updating the DataSource array, and the cell's background color is thus changing correctly. However, whenever I scroll back up I start seeing random cells with the modified background color, knowing…
Priest
  • 242
  • 4
  • 11
0
votes
1 answer

UITableView reloadData() overwrites previous cell data

I'm dynamically creating a UITableView and populating it with an Array, which is populated my a Dictionary. Issue is that when I make some changes in Dictionary, re-populate the Array accordingly and reload tableview data, previous cell datas remain…
Onur Çevik
  • 1,560
  • 13
  • 21
0
votes
2 answers

Reference to a cell with reuse identifier

I'm developing an iOS-App and therefore I use a UITableViewController. Within "cellForRowAtIndexPath" I use cells with reuse identifiers: [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyle1 reuseIdentifier:textFieldIdentifier]; The…
user3532505
  • 429
  • 1
  • 7
  • 18
0
votes
2 answers

tableview cells mix after scrolling (swift)

I made a table view that fills the cells with some data, which works fine. The problem is that, when I scroll the table, all the cells get mixed, do you know a way to stop this? func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:…
Luis Perez
  • 111
  • 8