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 3354406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:16:09+00:00 2026-05-18T02:16:09+00:00

I created an application using UITableView . I parsing the data from URL and

  • 0

I created an application using UITableView. I parsing the data from URL and listed in UITableView.

But in UITableView, the first the data only displayed again and again.

I don’t know why this problem occurred.

My code is as below:

-(UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    CGRect frame = CGRectMake(10.0f, 5.0, 300.0, 55);
    valueField = [[UILabel alloc] initWithFrame:frame];
    [valueField setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
    valueField.tag = 111;
    valueField.font=[UIFont fontWithName:@"Helvetica" size:16.0];
    valueField.textAlignment = UITextAlignmentLeft;
    valueField.lineBreakMode=UILineBreakModeWordWrap;
    valueField.numberOfLines = 0;
    valueField.textColor = [UIColor whiteColor];
    valueField.highlightedTextColor = [UIColor whiteColor];
    valueField.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
    valueField.adjustsFontSizeToFitWidth = YES;
    valueField.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
    valueField.text=[title1 objectAtIndex:count1];
    [cell.contentView addSubview:valueField];
    UIImage *favOn = [UIImage imageNamed:@""];
    UIImage *favOff = [UIImage imageNamed:@""];                   
    titlebutton = [[UIButton alloc] initWithFrame:CGRectMake(10.0f, 15.0, 300.0, 55)];
    [titlebutton setTag:indexPath.row];
    //titlebutton.tag = 111;
    [titlebutton setImage:favOff forState:UIControlStateNormal];
    [titlebutton setImage:favOn forState:UIControlStateSelected];
    if([self getFavState:@"111"]) 
    {
        [titlebutton setSelected:YES];
    }
    else 
    {
        [titlebutton setSelected:NO];
    }
    [titlebutton addTarget:self action:@selector(favButtonSwitch:) forControlEvents:UIControlEventTouchUpInside];
    [titlebutton setBackgroundColor:[UIColor clearColor]];
    [titlebutton setTitle:@"" forState:UIControlStateNormal];
    [cell.contentView addSubview:titlebutton];
    CGSize labelSize = [valueField.text sizeWithFont:valueField.font constrainedToSize:valueField.frame.size lineBreakMode:UILineBreakModeWordWrap];
    int labelHeight = labelSize.height;
    NSLog(@"labelHeight = %d", labelHeight);

    frame = CGRectMake(10.0f, 40.0, 300.0, 55);
    pubField = [[UILabel alloc] initWithFrame:frame];
    [pubField setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
    pubField.tag = 111;
    pubField.font=[UIFont fontWithName:@"Helvetica" size:12.0];
    pubField.textAlignment = UITextAlignmentLeft;
    pubField.lineBreakMode=UILineBreakModeWordWrap;
    pubField.numberOfLines = 0;
    pubField.textColor = [UIColor whiteColor];
    pubField.highlightedTextColor = [UIColor whiteColor];
    pubField.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
    pubField.adjustsFontSizeToFitWidth = YES;
    pubField.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
    pubField.text=[pubDate objectAtIndex:indexPath.row];
    [cell.contentView addSubview:pubField];

    frame = CGRectMake(5.0, 70.0, 300.0, 55);
    desField = [[UILabel alloc] initWithFrame:frame];
    [desField setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
    desField.tag = 111;
    desField.font=[UIFont fontWithName:@"Helvetica" size:13.0];
    desField.textAlignment = UITextAlignmentLeft;
    desField.lineBreakMode=UILineBreakModeWordWrap;
    desField.numberOfLines = 0;
    desField.textColor = [UIColor whiteColor];
    desField.highlightedTextColor = [UIColor whiteColor];
    desField.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
    desField.adjustsFontSizeToFitWidth = YES;
    desField.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
    desField.text=[description objectAtIndex:indexPath.row];
    [cell.contentView addSubview:desField];
    }

    UIImage *patternImage = [UIImage imageNamed:@"bg.jpg"];
    UIView *backView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
    backView.backgroundColor = [UIColor colorWithPatternImage: patternImage];
    cell.backgroundView = backView;

    NSString *image1 =[images objectAtIndex:indexPath.row];
    NSLog(@"Images  .....   = %@",image1);
    NSData *mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[images objectAtIndex:indexPath.row]]];
    UIImage *myimage = [[UIImage alloc] initWithData:mydata];
    UIImageView *imageView = [ [ UIImageView alloc ] initWithImage: myimage ];
    imageView.frame = CGRectMake(10.0f, 110.0f, 120.0f, 120.0f); 
    [cell.contentView addSubview:imageView];
    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-18T02:16:09+00:00Added an answer on May 18, 2026 at 2:16 am

    do all the alloc/init and all things, that will be the same in any cell in the

    if(cell==nil){
        //<-- here
    }
    

    while setting text and any thing that changes by the specific data outside the block

    if(cell==nil){
    
    }
    //<-- here
    

    i.e:

    if(cell==nil){
        //....
        valueField.tag = 111;
        valueField.font = [UIFont fontWithName:@ "Helvetica" size:16.0];
        valueField.textAlignment = UITextAlignmentLeft;
        valueField.lineBreakMode = UILineBreakModeWordWrap;
        valueField.numberOfLines = 0;
        valueField.textColor = [UIColor whiteColor];
        valueField.highlightedTextColor = [UIColor whiteColor];
        valueField.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
        valueField.adjustsFontSizeToFitWidth = YES;
        valueField.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
        [cell.contentView addSubview : valueField];
        //....
    }
    //....
    valueField.text = [title1 objectAtIndex:count1];
    //....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have created a web application, using ASP.NET, that allows users to upload documents
I have created a setup project using Visual Studio 2008. After the application is
I am having a problem using the Unity Application Block, I have created a
I've created an application using the Navigation-based template in Xcode. I've also created a
I'm using core data on an iPhone application. I have multiple persisntent stores that
I am using the plist to store the data entered in the UITextFields. But,
How do you create an application shortcut (.lnk file) in C# or using the
How do I create an Application Pool on IIS 6.0 using a PowerShell script?
I would like to create an application that runs on XBox 360 (downloaded using
I want to create a Java application bundle for Mac without using Mac. According

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.