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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:03:19+00:00 2026-05-30T09:03:19+00:00

i need two kinds of UITableViewCell that has different height: a) One with a

  • 0

i need two kinds of UITableViewCell that has different height:

a) One with a small UIImageView holding user picture, 3 UILabel’s and one UIImageView of 200 x 100.

b) The other has the same like a) without the UIImageView.

Well, in order to achieve this i have built two custom UITableViewCell’s and set my UITableView to use them.

The problem is when i scroll the table because sometimes it isn’t smooth.

My code is the following (i only post the cellForRowAtIndexPath)

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (.....) return HEIGHT1 
    else return HEIGHT2
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"CheckinCellIdentifier";
    static NSString *TextCellIdentifier = @"CheckinTextCellIdentifier";
    CheckIn *checkin = [self.checkinArray objectAtIndex:indexPath.row];

    if (checkin.photoUrl) {

        CheckinUITableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (cell == nil){
            NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CheckinUITableViewCell" owner:nil options:nil];

            for(id currentObject in topLevelObjects) {
                if([currentObject isKindOfClass:[CheckinUITableViewCell class]]) {
                    cell = (CheckinUITableViewCell *)currentObject;
                    if (self.userImage)
                        cell.userImage.image = self.userImage;
                    break;
                }
            }
        }

        cell.checkin = checkin;    
        UIImage *imageCheckin = [self.checkinImages objectForKey:[NSNumber numberWithInt:checkin.checkInId]];
        if (imageCheckin) {
            cell.checkinImage.image = imageCheckin;
        } else {
            CompleteBlock block = ^(NSData* imageData) {
                if (imageData) {
                    UIImage *image = [UIImage imageWithData:imageData];
                    [self.checkinImages setObject:image forKey:[NSNumber numberWithInt:checkin.checkInId]];
                    CheckinUITableViewCell *lookedUpCell = (CheckinUITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
                    if (lookedUpCell){
                        cell.checkinImage.image = image;
                        //[lookedUpCell setNeedsLayout];
                    }
                }
            };
            [Utility loadImageFromFile:checkin.photoPath url:checkin.photoUrl withCompletionBlock:block];
        }
        return cell;
    } else {
        CheckinTextUITableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:TextCellIdentifier];
        if (cell == nil){
            NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CheckinTextUITableViewCell" owner:nil options:nil];

            for(id currentObject in topLevelObjects) {
                if([currentObject isKindOfClass:[CheckinTextUITableViewCell class]]) {
                    cell = (CheckinTextUITableViewCell *)currentObject;
                    if (self.userImage)
                        cell.userImage.image = self.userImage;
                    break;
                }
            }
        }
        cell.checkin = checkin;    
        return cell;
    }

}

Any idea? Thanks!

  • 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-30T09:03:21+00:00Added an answer on May 30, 2026 at 9:03 am

    The possible problem of your code is that your Cells have never been reused. NSBundle loadNibNamed: create new Cell each time your table need it. So if dataSource contain 10000 records – you creates 10000 cells.

    Please check if you set cell identifier within xib file. This will cause to dequeue your cells.

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

Sidebar

Related Questions

In my specific case, I have two kinds of messages that I need to
I have a form that has a group of 3 text_fields. I need two
I have two tables containing two different kinds of comments. One of the tables
I need a way for a single variable to represent two kinds of objects
I need two methods one to encrypt and one to decrypt an xml file
Why do I need two of them? When I have to use one or
I am developing a REST API that supports two kinds of authentication protocols: login
I am working on an ASPX page that needs to handle multiple different kinds
I've got two small structural issues that I'm not sure how to handle given
Seam will fire different kinds of events that relate to particular scopes, tasks, or

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.