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
1 answer

Collection view button background image getting repeated on scroll

I have a collection view.I have a button called furnitureSelectionBtn inside the collection view cell. When i tap the button inside the collection view,it sets the button image as selected.png.When i tap it again it gets unselected and i set with…
pythonNinja
  • 453
  • 5
  • 13
0
votes
1 answer

Images in UIPageViewController are repeating in UICollectionView on every time cell creates. Using library for displaying Images in scrollView

I have specific problem regarding a library I am using for displaying images in UIPageViewController which I have added in a UICollectionView, this is the library that I am using, all my work is done through this library on first viewDidLoad, but…
0
votes
2 answers

dequeueReusableCell (withIdentifier identifier: String, for indexPath: IndexPath) returning 2 different cells at each call

don't know if you have encountered this situation, I use the function func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier:…
Trung Hoang
  • 94
  • 11
0
votes
2 answers

Collectionview in TableviewCell, data repeat

I've a collectionview inside my resizable tablviewCells. Tableview has one cell in each 'n' number of sections. Datasource and delegate of collectionview are set to the tableviewCell. There is an API called on tablview's cellForRowAt, and the result…
0
votes
1 answer

How to set UITableViewCell identifier in xcode?

I am getting a crash randomly when I select a cell in a UITableView in a viewcontroller in my project. I think the problem is caused by the cells I am trying to reuse. Here is the code. - (UITableViewCell *)tableView:(UITableView *)tableView…
tiw
  • 535
  • 1
  • 6
  • 22
0
votes
1 answer

Add UIViews to UIStackView programmatically inside UITableView

I have three elements UILabel, UIImageView and UIButton in a list. I have to show them accordingly inside UITableView. I have an array like this: tableArray = [["label", "img", "button"],["img","button","label"],["img","label","button"],["button",…
Arnab
  • 4,216
  • 2
  • 28
  • 50
0
votes
3 answers

Prevent a cell from being reused in AQGridView

I am using AQGridView for a grid of images.I need to overlay a progress bar over a particular image which is being downloaded. The problem is, if I scroll that Image cell out of view, the progress bar appears on another cell as well. I think this is…
Shreesh
  • 677
  • 5
  • 15
0
votes
3 answers

How to connect custom collectionviewCell to reuseidentifier with XIB - Swift

I am making a custom collectionview cell Using XIB. The collectionview is placed inside an viewController as an extension. This is the code i am using to call the Xib View but i get an error telling me i need to use reuseidentifier. But i have no…
Asbis
  • 432
  • 5
  • 16
0
votes
1 answer

Read IB UITableViewCell Reuse Identifier in XIB?

I have a XIB to design a UITableViewCell. I always register the XIB and then dequeue cells using a reuse-identifier, as is common. Does setting Attributes Inspector > Table View Cell > Identifier have any purpose when using a XIB?
meaning-matters
  • 21,929
  • 10
  • 82
  • 142
0
votes
1 answer

How to assign different reuseIdentifier for different index for UITableViewCell (created in XIB)

I have successfully created and linked the cell using the XIB,but the query is how do I assign different identifier (reuseIdentifier) to different cells of a UITableView? Suppose I have a tableView of SignUp Form ... So I would like to have the…
infiniteLoop
  • 2,135
  • 1
  • 25
  • 29
0
votes
1 answer

How to reuse a table view cell without overlapping other cells in tableview ios swift

I am getting the widgets/data overlapped in every cell when I scroll down or up my tableview. What I am doing is, I have an array in elements are wCheckinArray = ["Date", "TextFeild", "TextView", "Check", "Sign"]. Now I am checking if there is an…
Xcodian Solangi
  • 2,342
  • 5
  • 24
  • 52
0
votes
3 answers

scrolling tableview causes crash

I am facing a simple yet annoying problem of memory deallocation and message sending to a freed object. I am trying to get Rss feed from a web page. I developed the applet in 2 stages, in stage one , as i am yet new to iphone development i tried…
L_Sonic
  • 594
  • 6
  • 22
0
votes
0 answers

What is the way to load a fixed number of UICollectionViewCells without reuseIdentifier ? (Swift)

I have 5 columns in UICollectionView (horizontal scroll) and everything is working fine. Every UICollectionViewCell contains its own UITableView inside and sometimes there is a lot of data in it, so the UICollectionView scroll is not so smooth. I…
0
votes
0 answers

Is there any way to initialize my tableViewCell with a model and use that inside the tableViewCell class to just populate the rest of properties?

In the code below, I use a didSet to update the value of custom TableViewCell labels and image. I initially tried changing the init method of the my ArtistTableViewCell. I tried changing it to: init(style: UITableViewCellStyle, reuseIdentifier:…
mfaani
  • 33,269
  • 19
  • 164
  • 293
0
votes
1 answer

How does the rasterization works when reusing UITableViewCell?

If I setup rasterization as following: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *const cellIdentifier = @"UITableViewCell"; UITableViewCell *cell = [tableView…
xi.lin
  • 3,326
  • 2
  • 31
  • 57