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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:27:09+00:00 2026-05-26T07:27:09+00:00

i’am creating an iOS application which is similar to bbc application – I have

  • 0

i’am creating an iOS application which is similar to bbc application
– I have a table view which has two section
– 1st section contains cells containing scrollview wid images
– 2nd section contains expandable cells which contains scrollview did images
so the problem is that
when i use the dequereusable its showing weird behaviors like when the bottommost cell in the table is expanded the first cell in the first gets cleared etc etc
so i have just stopped using the queue and everything started working fine
but now when i added images after scrolling the cells which is not in the view gets refreshed and its
taking a lot of time to load

so could kindly guide me how to use the queue wisely in the code
described below
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

NSString *CellIdentifier=@"cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell== nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"hai"] autorelease];

///[here a different name has been used for the reuse identifier];////

      if ([self tableView:tableView inSection2:indexPath.section]) {
        Coffee *co =[appDelegate.coffeeArray2 objectAtIndex:indexPath.section-s1Count-1];
         cell.textLabel.text=co.coffeeName;

    }

    if ([self tableView:tableView inSection1:indexPath.section]) {

        Coffee *co =[appDelegate.coffeeArray1 objectAtIndex:indexPath.section];
        cell.textLabel.text = co.coffeeName;
        CGRect cellname = CGRectMake(5, 0, 290, 25);
        UILabel *cellabel = [[[UILabel alloc] initWithFrame:cellname] autorelease];

        cellabel.backgroundColor = [UIColor whiteColor];

        cellabel.font = [UIFont italicSystemFontOfSize:20];

        cellabel.textColor=[UIColor blueColor];

        cellabel.highlightedTextColor = [UIColor clearColor];

       cellabel.text=co.coffeeName;

        [cell.contentView addSubview:cellabel];


    }


// Configure the cell...

if ([self tableView:tableView canCollapseSection:indexPath.section]) 

{
    if (!indexPath.row)

    {     

        // first row

       // only top row showing



        if ([expandedSections containsIndex:indexPath.section])

        {

            cell.accessoryView = [myuicontroller accessoryWithColor:[UIColor grayColor] type:DTCustomColoredAccessoryTypeUp];

        }

        else

        {

            cell.accessoryView = [myuicontroller accessoryWithColor:[UIColor grayColor] type:DTCustomColoredAccessoryTypeDown];

        }





    }

    else

    {

        // all other rows

        cell.accessoryView = nil;    

        cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;


        CGRect cellname = CGRectMake(5, 0, 290, 25);

        UILabel *cellabel = [[[UILabel alloc] initWithFrame:cellname] autorelease];

        cellabel.backgroundColor = [UIColor whiteColor];

        cellabel.font = [UIFont italicSystemFontOfSize:13];

        cellabel.textColor=[UIColor blueColor];

        cellabel.highlightedTextColor = [UIColor clearColor];

       // cellabel.text =[NSString stringWithFormat:@"category"];

        [cell.contentView addSubview:cellabel];

        myscrollView *svb;
           svb=[[myscrollView alloc]initwitharray:appDelegate.newscat1];

}else{

    myscrollView *s;

    NSLog(@"inside the textlabel ext%@",cell.textLabel.text);

    NSLog(@"count of array  %d",[appDelegate.newscat1 count]);

    NSString *cat=cell.textLabel.text;

            [cell.contentView addSubview:s];

}

}   



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-26T07:27:10+00:00Added an answer on May 26, 2026 at 7:27 am

    You need to set the alternative reuse identifier before you dequeue the cell. At the moment you are dequeuing a cell with identifier “cell” regardless of the section you are in, so you will often be returning a section 0 cell for a section 1 part of the table.

    So, branch your code so that you do different things depending on the value of indexPath.section:

    if (indexPath.section == 0)
        cellIdentifier = @"thisCell";
    else
        cellIdentifier = @"otherCell";
    

    Then dequeue your cell, if it is nil, create with the same cell identifier variable above.

    You should only be adding subviews inside your (cell = nil) code – otherwise you will end up with cells with lots of overlapping subviews and will be wasting memory. If a cell has been dequeued, you just configure the existing subviews, you don’t make new ones. You can assign tags to your subviews as you add them to assist with this.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.