0

Please see this photo and help me, it is very important for me. thank you very much

enter image description here

Yucel Bayram
  • 1,653
  • 2
  • 22
  • 41

3 Answers3

1

I would implement heightforRowAtIndexPath for this, in short:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//first image height must be fetched for the ccurrent image using indexpath.row...

//Then use the height to set cell height:
    return imageHeight;
}
David Karlsson
  • 9,396
  • 9
  • 58
  • 103
0

Need to customize the height of the custom cell and also need to resize the image views inside the custom cell according to your image

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

CGFloat cellHeight = image1height + image2height + <button height>;

return cellHeight;

}

Also need to assign the imageView rect in the custom cell according to the images dynamically.

RAJA
  • 1,214
  • 10
  • 13
  • i do not now how get image size, i added my code please RAJA SAB can you help me to solve this –  Mar 06 '14 at 07:59
  • there is a porperty to get uiimage size. see this link.. http://stackoverflow.com/questions/5249664/iphone-how-get-the-height-and-width-of-uiimage – RAJA Mar 06 '14 at 08:02
0

This is my code

- (void)viewDidLoad {
    [super viewDidLoad];

    tableData = [NSArray arrayWithObjects:@"1.png", @"2.png", @"3.png", @"4.png", nil];

}


#pragma mark **** TableView ***
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

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


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


    static NSString *listTableIdentifier = @"CustomCell";
    CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:listTableIdentifier];


    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }


    cell.myImage1.image = [UIImage imageNamed:[tableData objectAtIndex:indexPath.row]];

    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 85;
}