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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:54:41+00:00 2026-05-28T05:54:41+00:00

I have a tableview cell in a view which has some text in it,the

  • 0

I have a tableview cell in a view which has some text in it,the verses of bible.but the scrolling is not at all smoother i have this code for UITableView

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

        return [delegate.allSelectedVerseEnglish count];


    }

    return 0;    

}



// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

   static NSString *CellIdentifier = @"Cell";

    readCell *cell = (readCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier

                 ] autorelease];
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"readCell" owner:self options:nil]; 
        cell = [nib objectAtIndex:0]; 
        cell.malayalamVerse.hidden = YES;
        cell.malayalamVerse.backgroundColor = [UIColor clearColor];
        cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];
        cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
        cell.textLabel.numberOfLines = 0;

        //pinch for serchpage
        UIPinchGestureRecognizer *longPressRecognizer = 
        [[UIPinchGestureRecognizer alloc]
         initWithTarget:self 
         action:@selector(longPressDetected:)];
        [self.view addGestureRecognizer:longPressRecognizer];
        [longPressRecognizer release];

        //longtap for simpklepopupview


        UILongPressGestureRecognizer *longPressgesture = 
        [[UILongPressGestureRecognizer alloc]
         initWithTarget:self 
         action:@selector(longPressDetectedgesture:)];
        [self.view addGestureRecognizer:longPressgesture];
        [longPressgesture release];
        if (imagedarkbackground.hidden == NO) {

            hideviewoftab.hidden =YES;
            cell.chapterAndVerse.backgroundColor= [UIColor clearColor];
            cell.chapterAndVerse.textColor = [UIColor whiteColor];
            cell.textLabel.textColor = [UIColor whiteColor];
            cell.textLabel.highlightedTextColor = [UIColor whiteColor];
            //cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:16];
        }
        else if (imagedarkbackground.hidden == YES){
            hideviewoftab.hidden =NO;
            cell.chapterAndVerse.backgroundColor= [UIColor whiteColor];
            cell.chapterAndVerse.textColor = [UIColor brownColor];
            cell.textLabel.textColor = [UIColor darkGrayColor];
            cell.textLabel.highlightedTextColor = [UIColor darkGrayColor];
        }


    }


    if(tableView == table)
    {
      UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
         myBackView.backgroundColor = [UIColor colorWithRed:250.0 green:248.0 blue:192.0 alpha:1.0];
        [myBackView setBackgroundColor:[UIColor colorWithRed:1 green:1 blue:0.75 alpha:1]];
       cell.selectedBackgroundView = myBackView;
        [myBackView release];
        table.backgroundColor = [UIColor clearColor];
        table.separatorColor = [UIColor clearColor];
        cell.chapterAndVerse.text = [NSString stringWithFormat:@"%d",indexPath.row+1];
        cell.chapterAndVerse.font = [UIFont fontWithName:@"Georgia" size:18.0];
        cell.chapterAndVerse.frame=CGRectMake(0, 10, 30.0, 20.0);
        cell.textLabel.text =  [NSString stringWithFormat:@"  %@",[delegate.allSelectedVerseEnglish objectAtIndex:indexPath.row]];

       // cell.textLabel.textColor = [UIColor darkGrayColor];
        cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];

        cell.backgroundColor = [UIColor clearColor];

    }
return cell;
}

this is the cell height code

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{


    CGSize textSize = [[delegate.allSelectedVerseEnglish objectAtIndex:indexPath.row] sizeWithFont:[UIFont fontWithName:@"Georgia" size:18.0 ]  constrainedToSize:CGSizeMake(290.0f,MAXFLOAT)   lineBreakMode:UILineBreakModeWordWrap];
    CGSize textSizelabel = [[NSString stringWithFormat:@"%d",indexPath.row+1] sizeWithFont:[UIFont fontWithName:@"Georgia" size:17.0 ]  constrainedToSize:CGSizeMake(290.0f,MAXFLOAT)   lineBreakMode:UILineBreakModeWordWrap];

    return textSize.height +18;
    return textSizelabel.height +18;

is there any mistake in my code that cause slow and sluggish scrolling.
Thanks in advance.

  • 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-28T05:54:42+00:00Added an answer on May 28, 2026 at 5:54 am

    Following code has few fixes:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
    {
        return 1;
    }
    
    
    // Customize the number of rows in the table view.
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
    {
        return [delegate.allSelectedVerseEnglish count];
    }
    
    
    // Customize the appearance of table view cells.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        static NSString *CellIdentifier = @"readCell";
    
        readCell *cell = (readCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) 
        {
    
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"readCell" owner:self options:nil]; 
            cell = [nib objectAtIndex:0]; 
            cell.malayalamVerse.hidden = YES;
            cell.malayalamVerse.backgroundColor = [UIColor clearColor];
            cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];
            cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
            cell.textLabel.numberOfLines = 0;
    
    
            if (imagedarkbackground.hidden == NO) 
            {
    
                hideviewoftab.hidden =YES;
                cell.chapterAndVerse.backgroundColor= [UIColor clearColor];
                cell.chapterAndVerse.textColor = [UIColor whiteColor];
                cell.textLabel.textColor = [UIColor whiteColor];
                cell.textLabel.highlightedTextColor = [UIColor whiteColor];
                //cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:16];
            }
            else if (imagedarkbackground.hidden == YES){
                hideviewoftab.hidden =NO;
                cell.chapterAndVerse.backgroundColor= [UIColor whiteColor];
                cell.chapterAndVerse.textColor = [UIColor brownColor];
                cell.textLabel.textColor = [UIColor darkGrayColor];
                cell.textLabel.highlightedTextColor = [UIColor darkGrayColor];
            }
    
    
        }
    
        //** If there is only one table then move the following case also inside the cell== nil clause with few minor changes....**/
        if(tableView == table)
        {
            UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
            myBackView.backgroundColor = [UIColor colorWithRed:250.0 green:248.0 blue:192.0 alpha:1.0];
            [myBackView setBackgroundColor:[UIColor colorWithRed:1 green:1 blue:0.75 alpha:1]];
            cell.selectedBackgroundView = myBackView;
            [myBackView release];
            table.backgroundColor = [UIColor clearColor];
            table.separatorColor = [UIColor clearColor];
            cell.chapterAndVerse.text = [NSString stringWithFormat:@"%d",indexPath.row+1];
            cell.chapterAndVerse.font = [UIFont fontWithName:@"Georgia" size:18.0];
            cell.chapterAndVerse.frame=CGRectMake(0, 10, 30.0, 20.0);
            cell.textLabel.text =  [NSString stringWithFormat:@"  %@",[delegate.allSelectedVerseEnglish objectAtIndex:indexPath.row]];
    
            // cell.textLabel.textColor = [UIColor darkGrayColor];
            cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];
    
            cell.backgroundColor = [UIColor clearColor];
    
        }
        return cell;
    }
    

    Move out following code in more suitable method, as it has nothing to do with cell or tableview.
    Also, review your code in if(tableView = table). If there is only one table then move the code where it fits.

    //pinch for serchpage
    UIPinchGestureRecognizer *longPressRecognizer = 
    [[UIPinchGestureRecognizer alloc]
     initWithTarget:self 
     action:@selector(longPressDetected:)];
    [self.view addGestureRecognizer:longPressRecognizer];
    [longPressRecognizer release];
    
    //longtap for simpklepopupview
    
    
    UILongPressGestureRecognizer *longPressgesture = 
    [[UILongPressGestureRecognizer alloc]
     initWithTarget:self 
     action:@selector(longPressDetectedgesture:)];
    [self.view addGestureRecognizer:longPressgesture];
    [longPressgesture release];
    

    I am not sure what you want to do in heightForRow method as it returns two values which is not possible.

    Update

    If you have two tableviews then you can use following code, as both tableviews will have separate cells that they will use so we need not set/reset other properties.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        static NSString *CellIdentifier = @"readCell";
    
        readCell *cell = (readCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) 
        {
    
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"readCell" owner:self options:nil]; 
            cell = [nib objectAtIndex:0]; 
            cell.malayalamVerse.hidden = YES;
            cell.malayalamVerse.backgroundColor = [UIColor clearColor];
            cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];
            cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
            cell.textLabel.numberOfLines = 0;
    
    
            if (imagedarkbackground.hidden == NO) 
            {
    
                hideviewoftab.hidden =YES;
                cell.chapterAndVerse.backgroundColor= [UIColor clearColor];
                cell.chapterAndVerse.textColor = [UIColor whiteColor];
                cell.textLabel.textColor = [UIColor whiteColor];
                cell.textLabel.highlightedTextColor = [UIColor whiteColor];
                //cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:16];
            }
            else if (imagedarkbackground.hidden == YES){
                hideviewoftab.hidden =NO;
                cell.chapterAndVerse.backgroundColor= [UIColor whiteColor];
                cell.chapterAndVerse.textColor = [UIColor brownColor];
                cell.textLabel.textColor = [UIColor darkGrayColor];
                cell.textLabel.highlightedTextColor = [UIColor darkGrayColor];
            }
    
            if(tableView == table1)
            {
                UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
                myBackView.backgroundColor = [UIColor colorWithRed:250.0 green:248.0 blue:192.0 alpha:1.0];
                [myBackView setBackgroundColor:[UIColor colorWithRed:1 green:1 blue:0.75 alpha:1]];
                cell.selectedBackgroundView = myBackView;
                [myBackView release];
                table.backgroundColor = [UIColor clearColor];
                table.separatorColor = [UIColor clearColor];
                cell.chapterAndVerse.text = [NSString stringWithFormat:@"%d",indexPath.row+1];
                cell.chapterAndVerse.font = [UIFont fontWithName:@"Georgia" size:18.0];
                cell.chapterAndVerse.frame=CGRectMake(0, 10, 30.0, 20.0);
                cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:18.0];
                cell.backgroundColor = [UIColor clearColor];
            }
            else if (tableView == table2)
            {
                // do something if needed... else leave it
            }
    
        }
    
    
        if(tableView == table1)
        {
    
            cell.textLabel.text =  [NSString stringWithFormat:@"  %@",[delegate.allSelectedVerseEnglish objectAtIndex:indexPath.row]];
    
        }
        else if(tableView == table2)
        {
            // set text or changeable properties here... for table 2
        }
        return cell;
    }
    
    
    heightForRowAtIndexPath:
    

    For two tables use following code(with your changes):

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
        CGFloat height = 0.0;
    
    
        if (tableView = table1)
        {
            CGSize textSize = [[delegate.allSelectedVerseEnglish objectAtIndex:indexPath.row] sizeWithFont:[UIFont fontWithName:@"Georgia" size:18.0 ]  constrainedToSize:CGSizeMake(290.0f,MAXFLOAT)   lineBreakMode:UILineBreakModeWordWrap];
            height =  textSize.height +18;
        }
        else if (tableView = table1)
        {
            CGSize textSizelabel = [[NSString stringWithFormat:@"%d",indexPath.row+1] sizeWithFont:[UIFont fontWithName:@"Georgia" size:17.0 ]  constrainedToSize:CGSizeMake(290.0f,MAXFLOAT)   lineBreakMode:UILineBreakModeWordWrap];
            height =  textSizelabel.height +18;
        }
        return  height;    
    }
    

    Thanks,

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

Sidebar

Related Questions

I have a tableView which has cells with phone numbers. The app is not
i have a tableview which has image and a text behind, i create the
So I have a view in which it has some view which has a
I have a uitableview 'A' which has cells, on clicking one of the cell,
I have a view which consists of a tableview and a navigation bar. For
I have a navigation view controller which navigates between some tableviews and I've just
I have a view which contains a tableview, (i call this view the EquationView,
I have a simple NSArray which has some arrays as objects which has some
I have created a controller class named TAddAlarmController which has a tableview which consists
I have a table view which I'm using for some settings in my app.

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.