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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:48:04+00:00 2026-05-24T08:48:04+00:00

hi I am new to iPad developing. So I am using web service to

  • 0

hi I am new to iPad developing. So I am using web service to display data in tableview. So how can I change the row heigh of each cell I tried but it showing more height for that one?
I used three arrays for displaying data in tableview So if I give more data to array through web Service. So how can I change for every row for table view. Can anyone help me ?

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [arrOutline1 count] + [arrOutline2 count];           
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{       
    if ((indexPath.row)%2==0) {
        return 100;         
    }
    else {          
         //strData3 =[[NSMutableString alloc]init];
        NSLog(@" the data is %@",[arrOutline3 objectAtIndex:countRow]);

        //strData3 = [NSMutableString stringWithFormat:@"%@",[arrOutline3 objectAtIndex:countRow]];
      int myLength = [[NSMutableString stringWithFormat:@"%@",[arrOutline3 objectAtIndex:countRow]] length]; 
        NSLog(@" the length of dat is :%d",myLength);

        int LengthCell;
            int LengthCell = myLength /3;
            CGFloat heightCell3 ;
        int l = LengthCell * 19;
        heightCell3 =(CGFloat )l;
        NSLog(@" the heigh of cell is :%f",heightCell3 );
        countRow = countRow + 1;
        return heightCell3;
    }
}

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

        static NSString *CellIdentifier = @"Cell";

        if ((indexPath.row)%2==0) {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

            txtlable1= [[UILabel alloc]initWithFrame:CGRectMake(50, 0, W, H)]; 
            txtlable1.backgroundColor=[UIColor clearColor];
            txtlable1.font=[UIFont fontWithName:@"Arial" size:25.0];
            txtlable1.text =[arrOutline1 objectAtIndex:count2];
            txtlable1.lineBreakMode = UILineBreakModeWordWrap;
            txtlable1.textAlignment = UITextAlignmentLeft;
            txtlable1.numberOfLines = 0;
            [[cell contentView]addSubview:txtlable1];
            [txtlable1 release];            

        txtlable2= [[UILabel alloc]initWithFrame:CGRectMake(600, 0, W-200, H)]; 
            txtlable2.backgroundColor=[UIColor clearColor];
            txtlable2.font=[UIFont fontWithName:@"Arial" size:20.0];
            txtlable2.textAlignment = UITextAlignmentLeft;
            txtlable2.lineBreakMode = UILineBreakModeWordWrap;
            txtlable2.numberOfLines = 0;
            txtlable2.text =[arrOutline2 objectAtIndex:count2];
            [[cell contentView]addSubview:txtlable2];
            count2 =count2+1;
            [txtlable2 release];
            return cell;

        }
    else {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

        int myLength = [[NSMutableString stringWithFormat:@"%@",[arrOutline3 objectAtIndex:count1]] length]; 
        NSLog(@" the length of dat is :%d",myLength);
        int LengthCell = myLength /3;
        CGFloat heightCell3 ;
        int l = LengthCell * 15;
        heightCell3 =(CGFloat )l;
        NSLog(@" the heigh of cell is :%f",heightCell3 );

        txtlable3=[[UILabel alloc]initWithFrame:CGRectMake(50,0,W+400,heightCell3)];  
        txtlable3.backgroundColor=[UIColor clearColor];

        txtlable3.font=[UIFont fontWithName:@"Arial" size:30.0];
        txtlable3.lineBreakMode = UILineBreakModeWordWrap;
        txtlable3.numberOfLines = 0;

        txtlable3.text =[arrOutline3 objectAtIndex:count1];
        [cell addSubview:txtlable3];
        count1 = count1 + 1;

        return cell;
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    arrOutline1 = [[NSMutableArray alloc]initWithObjects:@"vijay sankar ramamknkakjdkl.\n the thinking the main. candidate of things  thisisingamaldaj",@"Amith",@"Gupta",@"RightData",@"RightData1",@"RightData2",@"RightData3",@"RightData4",@"RightData5",@"RightData6",nil];
    arrOutline2 = [[NSMutableArray alloc]initWithObjects:@"ganesh",@"surya",@"sudha",@"LeftData",@"LeftData1",@"LeftData2",@"LeftData3",@"LeftData4",@"LeftData5",@"LeftData6",nil];
    arrOutline3 = [[NSMutableArray alloc]initWithObjects:@"vijay sankar ramamknkakjdkl.\n the thinking the main.\n candidate of things  thisisingamaldaj .\n ",@"jagadish",@"night fhdfhda fhadfhadf.\n dfafhdjkahfa",@"3rdData",@"3rdData1 .\n vijay sankar ramamknkakjdkl.\n the thinking the main.\n candidate of things  thisisingamaldaj",@"3rdData2",@"3rdData3",@"3rdData4",@"3rdData5",@"3rdData6 3rdData1 .\n vijay sankar ramamknkakjdkl.\n the thinking the main.3rdData1 .\n vijay sankar ramamknkakjdkl.\n the thinking the main.3rdData1 .\n vijay sankar ramamknkakjdkl.\n the thinking the main.",nil];

    CGFloat heihtTable;
    heihtTable =[arrOutline1 count] + [arrOutline3 count] ;
    heihtTable =heihtTable *175 ;
    scrl.contentSize=CGSizeMake(728,heihtTable);
    count1=0;
    count2=0;
    countRow =0;
        lblCompetency = [[UILabel alloc]initWithFrame:CGRectMake(20, 50, 400, 100)];
    lblCompetency.text = @"Competency";
    lblCompetency.font = [UIFont fontWithName:@"Helvetica" size: 24.0];
    [self.scrl addSubview:lblCompetency];

    NSLog(@"The height is %f",heihtTable);
    TableOutline = [[UITableView alloc] initWithFrame:CGRectMake(10, 150,1000,heihtTable) style:UITableViewStyleGrouped];
    TableOutline.separatorColor=[UIColor blackColor];
    TableOutline.backgroundColor=[UIColor clearColor];
    [TableOutline setUserInteractionEnabled:NO];
    TableOutline.opaque=YES;
    TableOutline.delegate =self;
    TableOutline.dataSource = self;
    TableOutline.allowsSelection=FALSE;

    UIView *viewTable2=[[UIView alloc]initWithFrame:CGRectMake(10, 200, 1000, heihtTable)];
    viewTable2.backgroundColor=[UIColor clearColor];
    TableOutline.backgroundView =viewTable2;
    [self.scrl addSubview:TableOutline];    
}
  • 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-24T08:48:05+00:00Added an answer on May 24, 2026 at 8:48 am
    - (CGFloat) tableView: (UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath
    {
        CGSize labelSize = CGSizeMake(200.0, 20.0);
        NSString *strTemp = [arrServices objectAtIndex:indexPath.row];
        if ([strTemp length] > 0)
            labelSize = [strTemp sizeWithFont: [UIFont boldSystemFontOfSize: 14.0] constrainedToSize: CGSizeMake(labelSize.width, 1000) lineBreakMode: UILineBreakModeWordWrap];
        return (labelSize.height + 10);
    }
    

    This is what I used in my project and it worked perfectly well. Change the values according to your requirements.

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

Sidebar

Related Questions

I am new in ios development.Now,i am developing an Ipad application using ios 4.2
New to WCF, but familiar with COM+ - can I wrap a WCF service
I'm developing iPad html5 webpage that needs to display pages from other origins (different
I am new in iphone, i am developing an ipad application (like offline mode
I am developing for iPad and have created a standard UISplitViewController application using the
I'm new to using the split view for creating iPad applications. When I first
I am totally new to making ipad/iphone application. I am totally new to using
I'm new to objective-c and iOS development. I need an iPad application to display
I am new to iPad/iPhone apps/games development. I am developing a game. The game
I'm in early (pre-coding) stages of developing a mobile web application using jQuery Mobile

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.