I have a custom cell and i displayed that custom cell in a table view with method numberOfRowsInSection return 100.
But when I edit one of the textfield it will reflect the changes in other textfields also.
this is my code for cellForROwAtIndexPath
NSString *CellIdentifier = @"viewAllProductsGridCell";
ViewAllProductsGridCell *cell = (ViewAllProductsGridCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"ViewAllProductsGridCell" owner:self options:nil];
cell = gridCell;
}
Will u pls tell me how to create multiple instances for each cell
It looks like you’re using the same cell instance for all your rows.
You must create a separate cell instance for each row.
Update:
What I usually do for multiple custom cells is the following:
the predefined value (like textFieldCell)
or adding controls to it
subclass from UITableViewCell in your project and add declare all
IBOutlets or IBActions you need in it; don’t forget to change the
class property of your cell in nib to the MyTextFieldCell
When finished with customization, you can use the following code: