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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:55:30+00:00 2026-05-23T23:55:30+00:00

my code is // Customize the appearance of table view cells. – (UITableViewCell *)tableView:(UITableView

  • 0

my code is

// Customize the appearance of table view cells.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];


    ///   labels - names of Cities   ///


    UILabel *lblCity = [[UILabel alloc]initWithFrame:CGRectMake(15, 00, 200, 22)];
    lblCity.font = [UIFont systemFontOfSize:14];
    lblCity.backgroundColor = [UIColor clearColor];
    //lblCity.backgroundColor = [UIColor redColor];

    UILabel *lblDate = [[UILabel alloc]initWithFrame:CGRectMake(200, 00, 200, 22)]; 
    lblDate.font = [UIFont systemFontOfSize:14];
    lblDate.backgroundColor = [UIColor clearColor];
    //lblDate.backgroundColor = [UIColor redColor];

    UILabel *lblSchool = [[UILabel alloc]initWithFrame:CGRectMake(350, 00, 400, 22)];
    lblSchool.font = [UIFont systemFontOfSize:14];
    lblSchool.backgroundColor = [UIColor clearColor];
    //lblSchool.backgroundColor = [UIColor redColor];


    ///    Labels for description of city events    ///


    UILabel *lblEvent = [[UILabel alloc]initWithFrame:CGRectMake(15, 00, 200, 30)];
    lblEvent.font = [UIFont systemFontOfSize:12];
    lblEvent.backgroundColor = [UIColor clearColor];

    UILabel *lblEventAtDate = [[UILabel alloc]initWithFrame:CGRectMake(200, 00, 200, 30)];
    lblEventAtDate.font = [UIFont systemFontOfSize:12];
    lblEventAtDate.backgroundColor = [UIColor clearColor];

    UILabel *lblEventAtSchool = [[UILabel alloc]initWithFrame:CGRectMake(350, 00, 400, 30)];
    lblEventAtSchool.font = [UIFont systemFontOfSize:12];
    lblEventAtSchool.backgroundColor = [UIColor clearColor];



    if(RequestType == 2)
    {

        UIImageView *imgEventLabel = [[UIImageView alloc]initWithFrame:CGRectMake(00, 00, 480, 22)];

        UIView *viewDescription = [[UIView alloc]initWithFrame:CGRectMake(00, 00, 480, 35)];


        if(indexPath.row == 0)

        {
            static NSString *CellIdentifier = @"Cell11";

            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

                lblCity.text = @"City" ;
            //  [cell addSubview:lblCity];

                lblDate.text = @"Date" ;
            //  [cell addSubview:lblDate];

                lblSchool.text = @"School" ;
            //  [cell addSubview:lblSchool];

                imgEventLabel.image = [UIImage imageNamed:@"city_date_place.png"];
            //  [cell addSubview:imgEventLabel];



                [imgEventLabel addSubview:lblCity];
                [imgEventLabel addSubview:lblDate];
                [imgEventLabel addSubview:lblSchool];

                [cell.contentView addSubview:imgEventLabel];

            }

            return cell;
        }

        if(indexPath.row == 1)

        {
            static NSString *CellIdentifier = @"Cell12";

            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

                cell.selectionStyle=UITableViewCellSelectionStyleNone;
                cell.backgroundColor=[UIColor clearColor];
                cell.textLabel.numberOfLines = 999;


                lblEvent.text = @"Event in City";
                lblEventAtDate.text = @"Event on Date";
                lblEventAtSchool.text = @"Event at School";

                [viewDescription addSubview:lblEvent];
                [viewDescription addSubview:lblEventAtDate];
                [viewDescription addSubview:lblEventAtSchool];

                [cell.contentView addSubview:viewDescription];

            }

            return cell;


    }


    }

    // Configure the cell...

    return cell;
}

I don’t know where is fault, Please Help.

  • 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-23T23:55:32+00:00Added an answer on May 23, 2026 at 11:55 pm

    After your first call of dequeueReusableCellWithIdentifier: You didn’t check for nil and create a new one if there are no available cells in the reuse queue.

    In other words, if there are no cells in the reuse queue, your request type is not equal to 2, and row is not equal to 0 or 1, your cell will not be created. This causes an exception you see in the console.

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

Sidebar

Related Questions

I am trying to create 3 table view cells using code (w/o nib). I
In the following bit of code, I'm setting the table view cell text with
I am trying to customize the font of a UITableViewCell using the following code
I'm trying to customize a table view to display a feed of youtube videos
Hello I am using grouped table view and selecting Tableview's cell with blueselection style.
I have a 1920x1200 screen an would like to customize VS2008 code windows to
Got my little mechanize code: br.open('http://tumblr.com/customize'); print br.response().read() print br.form['edit_tumblelog[cname]'] # there definitely is
In Eclipse IDE how do you customize the Java code style formatter to have
I have TableCellViewController for managing cells in my UITableView. Each cell has a label
Is there more work, or source code files required to customize your look and

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.