Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6064767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:18:58+00:00 2026-05-23T09:18:58+00:00

hi this is my problem: i receive some datas from a php script to

  • 0

hi this is my problem:

i receive some datas from a php script to my tableview. But when i scroll down and back to the top my data is unreadable. The same if i scroll down. the data are superimposed

this is my code :

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return [messageArray count];    

}



- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    CGSize  textSize = { 260.0, 20000.0 };          

    NSMutableDictionary *dict = [messageArray objectAtIndex:indexPath.row];
    NSString *aMsg = [dict objectForKey:@"message"];

    CGSize size = [aMsg sizeWithFont:[UIFont systemFontOfSize:13.0] constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap];
    size.height += 5;

    CGFloat height = size.height<36?36:size.height;

    return height;
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
      cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
            }

    NSMutableDictionary *tempMsg = [messageArray objectAtIndex:indexPath.row];


    CGFloat result = 20;
    CGSize textSize = { 260.0, 20000.0 };


    NSMutableDictionary *dict = [messageArray objectAtIndex:indexPath.row];

    NSString *aMsg = [[dict objectForKey:@"message"]stringByReplacingOccurrencesOfString:@"\n" withString:@""];

    CGSize size = [aMsg sizeWithFont:[UIFont systemFontOfSize:15.0] constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap];

    result = MAX(size.height -5.0, 25.0);


    // Configure the cell.

    CGRect frame = CGRectMake(15, 5, size.width , size.height);
    UILabel *label = [[UILabel alloc] initWithFrame:frame];

    label.text = [tempMsg  objectForKey:@"message"];
    label.font = [UIFont systemFontOfSize:13];
    label.numberOfLines = 0;
    [label sizeToFit];
    label.backgroundColor = [UIColor clearColor];
    [cell.contentView addSubview:label];

    [label release];




    [cell setFrame:CGRectMake(20.0, 0.0, size.width, result)];

    UIImage* balloon = [[UIImage imageNamed:@"grey.png"] stretchableImageWithLeftCapWidth:24  topCapHeight:15];
    UIImageView *newImage = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, size.width+35, result+10)];
    UIView *newView =[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, cell.frame.size.width, cell.frame.size.height)];

    [newImage setImage:balloon];
    [newView addSubview:newImage];
    [cell setBackgroundView:newView];



    return cell;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:18:59+00:00Added an answer on May 23, 2026 at 9:18 am

    You are adding a new UILabel and a UIImageView each time the tableview-cell is requested. As a result after scrolling down and up again the Table-View-Cells contains multiple labels and images.

    You should subclass the UITableViewCell with an additional UILabel and UIImageView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm receiving some data from a ZODB (Zope Object Database). I receive a mybrains
I have a page that display some data. It is loaded from a database
I want to output some dynamic data from an ASP.NET website to Excel. I
For my framework I've written down this concept to solve the form validation problem.
I want to parse some google service page data (adplanner). The problem is that
This is a simple problem. I am working on a PHP project related to
I'm sending some data over AJAX to a PHP file. It's about filter options.
I have an class which should send/receive data in packet form. This class contains
I am receiving data from a hardware device. I receive it as an array
Hi all I have seen all question related to this problem but couldn't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.