Please see this photo and help me, it is very important for me. thank you very much
Asked
Active
Viewed 1,830 times
0
-
2post your relevant code – codercat Mar 06 '14 at 07:22
-
In CellForRowAtIndexPath, you will create an UIImageView and increase the cell Height for particular index. – Anand Gautam Mar 06 '14 at 07:24
-
Create a custom table cell for that. Example at http://www.appcoda.com/customize-table-view-cells-for-uitableview/ – Himanshu Joshi Mar 06 '14 at 07:26
-
whether the image is from local or web – CoolMonster Mar 06 '14 at 07:29
-
i created custom table cell, but image size all same, i have 2 imageview and all image height are different height, so i want to display images with orjinal image size – Mar 06 '14 at 07:31
-
Please describe your problem in text form in the question as well. Having the question primarily consist of an image makes this question have almost no future value (which goes against what [so] is about), as Googling for something similar is unlikely to get someone here, as images aren't indexed. – Bernhard Barker Mar 06 '14 at 07:31
-
set cell height according to your image size. – Anand Gautam Mar 06 '14 at 07:36
-
i do not know how to do that – Mar 06 '14 at 07:37
-
what you have tried.. post your code. – Anand Gautam Mar 06 '14 at 07:40
3 Answers
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;
}