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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:53:15+00:00 2026-05-26T11:53:15+00:00

i am a new programmer of Iphone App….. i wants three cells in table

  • 0

i am a new programmer of Iphone App….. i wants three cells in table (which are different height)

i write the code for this task..and output is satisfactory…… but i don’t know.. this is right method or not…..

thanks in advance….. 🙂

CGRect frame=CGRectMake(5, 43, 311, 363);

UITableView *table=[[UITableView alloc]initWithFrame:frame style:UITableViewStylePlain];

table.dataSource=self;

table.delegate=self;



-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath: (NSIndexPath *)indexPath
{
    static int counter=1;

    if(counter==1)
    {
        counter=counter +1;
        return 163;

    }
    else if(counter ==2)
    {
        counter=counter +1;
        return 80;

    }
    else 
    {
        counter=counter +1;
        return 60;

    }
    if(counter==4)
    {
        counter=1;
    }

}
  • 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-26T11:53:16+00:00Added an answer on May 26, 2026 at 11:53 am

    No, this isn’t right. Use indexPath.row instead of your counter variable. This will be the row number your delegate is being asked about. When scrolling upwards, for example, you may not get the expected results with your current code.

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

Sidebar

Related Questions

resize a image in table view cell... i am new programmer by this code
I am a new Programmer in Iphone... i wants use facebook in my app..and
New programmer here, I am trying to understand and break down this code below
I am a new programmer and still learning. This is the code that I
I am a new programmer who is new to iPhone development and server stuff.
I’m a new iPhone programmer I have created some small views without delegates.... If
hi i am new iphone programmer i want to know that can we create
hi i am a new iphone programmer i am creating a imagedisplay type application
I am a new programmer of Iphone Application. I work dynamically not use nib
I'm a fairly new programmer so please bear with me on this. I am

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.