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

  • Home
  • SEARCH
  • 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 6779955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:26:58+00:00 2026-05-26T16:26:58+00:00

I created a list of Youtube videos but there are some problems: – (UITableViewCell

  • 0

I created a list of Youtube videos but there are some problems:

- (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];
    }

    NSString *url = [selectedCellItem.content objectAtIndex:indexPath.row];

    UIWebView *wbView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, ROW_HEIGHT, ROW_HEIGHT)];
    wbView.tag = 1;
    [cell.contentView addSubview:wbView];
    [wbView release];

    NSString *embedHTML = @"\
    <html><head>\
    <style type=\"text/css\">\
    body {\
    background-color: transparent;\
    color: white;\
    }\
    </style>\
    </head><body style=\"margin:0\">\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"%0.0f\" height=\"%0.0f\"></embed>\
    </body></html>";

    NSString *html = [NSString stringWithFormat:embedHTML,url, ROW_HEIGHT, ROW_HEIGHT];
    UIWebView *thisVideoView = (UIWebView *)[cell.contentView viewWithTag:1];  
    thisVideoView.delegate = self;
    [thisVideoView loadHTMLString:html baseURL:nil];

    CGFloat cellWidth = [UIScreen mainScreen].bounds.size.width-ROW_HEIGHT-5;
    NSString *cellValue = [selectedCellItem.title objectAtIndex:indexPath.row];
    CGRect labelFrame = CGRectMake(ROW_HEIGHT+5, 0.0, cellWidth, ROW_HEIGHT);
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:labelFrame];

    titleLabel.tag = 2;
    titleLabel.text = cellValue;
    titleLabel.font = [UIFont systemFontOfSize:14.0];
    [titleLabel setNumberOfLines:10];
    [cell.contentView addSubview:titleLabel];
    [titleLabel release];

    return cell;
}

At the beginning, my app works just fine. However, when I click one cell multiple times the label starts overlapping with other cell labels. How can I fix this problem?

  • 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-26T16:26:58+00:00Added an answer on May 26, 2026 at 4:26 pm

    It’s happening because you’re creating the titleLabel everytime the function is called. Keep in mind that cell are re-used when table view is scrolled, so basically everytime a cell is used you’re re-creating the titleLabel without removing the old one

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

Sidebar

Related Questions

I have dynamically created some list of RadioButtons with some values. pro grammatically I
I am trying to create a list of videos to be fetched via YouTube.
I am created List of object class and return from CreateListFromTable method. But always
I'm trying to obtain a list of videos from Youtube to be displayed on
I'm building a jquery ajax page that shows a list of youtube videos. I've
I have a dynamically created list. Items from the list should be able to
I am trying to use dynamically created list in WHERE, for example: select *
I created a list with a TextView and an EditText in each item. In
I created the list that have device detected, and I want to send data
I've created a list of files using: file(GLOB_RECURSE DEPLOY_FILES ${PROJECT_SOURCE_DIR}/install/*) I want to install

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.