0

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:[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:
ram
  • 3
  • 1

1 Answers1

0

There is no way you can span one cell fro two rows. I would give you two options:

  1. Split the image manually in two parts and put them into one column in two rows
  2. 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.

ULysses
  • 978
  • 4
  • 9
  • hmm thanks but i saw some one did that?? i got one png having all 3 cells info . how they did :( – ram Jul 26 '10 at 14:25
  • they could've cropped the png in the code. It's easy to do with the Image class – ULysses Jul 26 '10 at 14:31
  • taken from here: http://stackoverflow.com/questions/158914/cropping-a-uiimage; `CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage], cropRect); // or use the UIImage wherever you like [UIImageView setImage:[UIImage imageWithCGImage:imageRef]]; CGImageRelease(imageRef);` – ULysses Jul 26 '10 at 14:48