Problem with Custom UITableViewCell becoming empty?

I have a grouped table view that utilizes two different custom table cells.

When i scroll through the table so that one (or more) of the cells goes either above or below what is visible those cells become blank. When i scroll back up (or down) to view these cells they are still blank. Why is this? The cells showed the appropriate content when they were first loaded.

Here is the code that loads the cells at the specified indexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.section==0) { FMLFullTextCell = (FullTextCell *) [tableView dequeueReusableCellWithIdentifier:FullTextCell_ID]; if(FMLFullTextCell==nil) { [[NSBundle mainBundle]loadNibNamed:@"FullTextCell" owner:self options:nil]; [FMLFullTextCell initWithFMLText:@"Here is some demo fml text"]; } return FMLFullTextCell; } else { FMLAuthorCell=(Author *)[tableView dequeueReusableCellWithIdentifier:AuthorCell_ID]; if(FMLAuthorCell==nil) { [[NSBundle mainBundle]loadNibNamed:@"Author" owner:self options:nil]; [FMLAuthorCell initWithTitle:@"Author" initWithAuthor:@"JohnnyAuthor"]; } return FMLAuthorCell; } }

-------------Problems Reply------------

You did not provide enough information to answer this question.

Usually UITableViewCells get cached when created via initWithFrame:reuseIdentifier: and accesed via dequeueReusableCellWithIdentifier:. My guess would be, that you did not specify different reuse identifier for your two different custom table cells, and because of that they get mixed up in your code somehow. This might cause the described behavior.

Anyway, without seeing some code, this is hard to answer. You should at least show us the tableView:cellForRowAtIndexPath method of your datasource.

Category:iphone Views:0 Time:2009-04-04

Related post

  • problem with custom uitableviewcell 2011-08-25

    I have been playing around with tableviews for the past few days trying to get used to them, today I have been trying to create a custom uitableviewcell, I am working from the Table View Programming Guide in the apple documents and have this weird pr

  • Multi Touch problem in Custom UiTableViewCell 2011-08-22

    static NSString *cellIdentifier = @"Cell"; AssignmentTableCell *cell = (AssignmentTableCell *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if(cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AssignmentTableCell" o

  • Problem in displaying custom UITableViewCell 2010-05-31

    I have a tableview displaying data using a custom UITableViewCell(say cell1). On touch of a row, I change the custom cell to another custom UITableViewCell(say cell2). Also I increase the size of row of the selected cell to accomodate, more items of

  • Custom UITableViewCell label font problems 2011-03-17

    So I've got a custom UITableViewCell created in a nib file in IB, very basic it has got an imageview, and two labels for now. I've got the table populating with the correct cells in their correct sizes and everything, but there is one slight problem.

  • custom UITableViewCell item problems 2009-07-16

    I have a custom UITableViewCell with 3 items: a UILabel a UITextField and a UIButton My question is, how do I know from which cell the button was clicked or textField was edited ? Is there a way to track them? Thanks for any replies. --------------So

  • Problem displaying a custom uitableviewcell content 2011-06-05

    I've a custom UITableViewCell with a UITextView in it. The cell grows dinamically with the uitableview as user enters text. When I display the table, I have to calculate the height of the custom cell depending on the content text entered by the user,

  • What are Recommended Ways to Optimize Memory and Usability Speed of custom UITableViewCells with multiple UIImages? 2011-02-05

    I am using a custom UITableViewCell with 3 UIImages in a UITableView with 50-100 rows. Its similar to a UITableViewCell the Facebook iPhone app uses for its news feed view. The application has 4 similar UITableViews which may be open at the same time

  • Custom UITableViewCell, UITableView and allowsMultipleSelectionDuringEditing 2012-02-01

    I have a problem using iOS 5 new functionality to select multiple cells during editing mode. The application structure is the following: -> UIViewController ---> UITableView ----> CustomUITableViewCell where UIViewController is both the dele

  • Setting custom UITableViewCells height 2009-01-30

    I am using a custum UITableViewCell which has some labels, buttons and imageviews to be displayed. There is one label in the cell whose text is a NSString object and the length of string could be variable. Due to this, I cannot set a constant height

  • How do you load custom UITableViewCells from Xib files? 2009-02-12

    The question is simple: How do you load custom UITableViewCells from Xib files? Doing so allows you to use Interface Builder to design your cells. The answer apparently is not simple due to memory managment issues. This thread mentions the issue and

  • iPhone - How to determine in which cell a button was pressed in a custom UITableViewCell 2009-06-22

    I currently have a UITableView that is populated with a custom UITableViewCell that is in a separate nib. In the cell, there are two buttons that are wired to actions in the custom cell class. When I click one of the buttons, I can call the proper me

  • iPhone Development - Another question on resizng UILabel & custom UITableViewCell 2009-07-25

    I've used following function in some of my projects, but recently I've created a small example which suggest that it's not reliable (at least in some situations): [NSString sizeWithFont:font constrainedToSize:size] [NSString sizeWithFont:font constra

  • Calling a modal window from within a custom UITableViewCell 2009-08-12

    I have a UITableView and inside it I create a custom UITableViewCell in the follwoing way: ItemCellController *cell = (ItemCellController *)[tableView dequeueReusableCellWithIdentifier:ContentListsCellIdentifier]; ... cell = [[[ItemCellController all

  • UIWebView in custom UITableViewCell 2009-09-17

    i am not sure if this is a good route to go,...i have some data i receive from the web which in turn, populates a table view. The problem is, the text is html (p tags, etc). My first thought was to create a uiwebview in the cell, and populate with lo

  • iPhone app - some custom UITableViewCell questions 2009-11-01

    At the moment, I have a settings view in my iPhone app built with Interface builder, it consists of a background image, some text fields, labels and buttons. Because this looks bad, I want to convert the settings view to an UITableView with custom UI

  • Where to place the update logic for a custom UITableViewCell? (iPhone) 2009-11-15

    I just have a quick "best practice" question regarding custom cells in a UITableView. My problem arises when I have build a custom cell in the if(cell == nil) block in the - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPa

  • Custom UITableViewCell rounded corners (grouped style) 2010-01-06

    When creating a custom UITableViewCell I notice that it looks as expected in 'plain' style but that the corners of the cells are not rounded if the table view is displayed in 'grouped' style: i.e. the corners are square. I have searched but cannot fi

  • Customized UITableViewCell dissappears 2010-01-12

    I've seen a number of people having a similar issue, but either their solution did not help, or it was too different. My problem is, I have a customized UITableViewCell, custom size, image and content. When I scroll up or down and then back again, th

  • iPhone: How to Define and Use a Custom UITableViewCell from a Nib File 2010-03-13

    I'm trying to create a single custom UITableViewCell from a xib, among other normal UITableViewCell's. I've tried quite a few varied things with no success. Can anyone help me please? --------------Solutions------------- The simplest method is to cre

Copyright (C), All Rights Reserved.

processed in 0.161 (s). 11 q(s)