filling image in table view for 2 data for iphone
i have a png that shows 2 cell values data like lets say home and address but i dont know how to show them in 2 cells like in upper cell will be home and bottom will be address
right now my image is compressed in 1 cell only i cant continue for 2nd cell any idea
switch(indexPath.section)
{
// cell.detailTextLabel.text
case 0:
labela = (UILabel *)[cell viewWithTag:0];
//labela.font = [UIFont systemFontOfSize:14];
labela.textColor = [UIColor whiteColor];
[labela setFont开发者_JAVA技巧:[UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]];
labela.text = [NSString stringWithFormat:@"%@", aBook.name];
cell.text = labela.text;
//cell.text=aBook.cuisine;
cell.imageView.image = [UIImage imageNamed:@"hamburger-icon.png"];
//cell.imageView.image = [UIImage imageNamed:@"Health and BeautyCell.png"];
///[labela release];
NSLog(@" BUTTON IS DOWN and GALLERY is working ");
//cell.imageView.image = [UIImage imageNamed:@"Health and BeautyCell.png"];
**cell.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CardView.png"]] autorelease];** // this image i want to display on both 0 , 1 case
break;
case 1:
label = (UILabel *)[cell viewWithTag:0];
[label setFont:[UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]];
//label.font = [UIFont systemFontOfSize:14];
label.textColor = [UIColor whiteColor];
label.text = [NSString stringWithFormat:@"%@", aBook.address];
cell.imageView.image = [UIImage imageNamed:@"home-icon.png"];//ChildSeat notes-icon.png
break;
case 2:
There is no way you can span one cell fro two rows. I would give you two options:
- Split the image manually in two parts and put them into one column in two rows
- Put the image into one row (use the
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
method to set the height of that row) and create manually a content cell that will contain two text inputs one under another so that they will correspond to the provided images.
Personally I would prefer the first case.
精彩评论