-2

I have two arrays1)image_array and 2)text_array.I know how to display images and text .

 cell.imageView.image = [UIImage imageNamed:[text objectAtIndex:indexPath.row]];

    cell.textLabel.text = [arry objectAtIndex:indexPath.row];   

it's showing like

image1     text1
image2     text2
image3     text3
|
|
image7     text7

But I need like

    image1
    text1

    image2
    text2

|
|
    image7
    text7

Please give me any idea.Thanks in Advanced.

ios start
  • 65
  • 8

3 Answers3

0

What about creating a custom cell and setting their image view and label frame properties?

cell.imageView.frame = CGRectMake(XORIG, 0, WI, HI);
cell.textLabel.frame = CGRectMake(XORIG, cell.imageView.frame.origin.y + cell.imageView.frame.size.height, WL, HL);
lihudi
  • 860
  • 1
  • 12
  • 21
0

try this

set cell style to subtitle and then

cell.imageView.image = [UIImage imageNamed:[text objectAtIndex:indexPath.row]];
cell.detailTextLabel.text = = [arry objectAtIndex:indexPath.row]; 
Ravi
  • 2,441
  • 1
  • 11
  • 30
0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *CellIdentifier = [NSString stringWithFormat:@"cell %d",indexPath.row];

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell = nil;

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

        UIImageView *myimagview = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
        myimagview.image = [UIImage imageNamed:@""];
        [cell.contentView addSubview:myimagview];
        [myimagview release];


        UILabel *lbl=[[UILabel alloc]init];
        lbl.frame=CGRectMake(10,60, 250, 20);
        lbl.backgroundColor=[UIColor clearColor];
        lbl.font = [UIFont fontWithName:@"ArialMT" size:14];
        lbl.textColor = [UIColor grayColor];
        lbl.text=@"";
        [cell.contentView addSubview:lbl];
        [lbl release];


        cell.selectionStyle = UITableViewCellSeparatorStyleNone;

    }
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 90;
}
Bhavesh Nayi
  • 3,626
  • 1
  • 27
  • 42