UIImageView snapped at the border of the UITableViewCell


#1

Hi guys. I am having a problem that I am not able to resolve.

In my .xib file I have positioned the UIImageView at X = 29 and Y = 22, resulting a good padding between the border of the cell and the UIImageView. But when i build and run Homepwner in the simulator the UIImageView is snapped to the border of the cell, in both, iPad Simulator and iPhone Simulator.

I am trying to positioning the UIImageView in ItemsViewController.m, just here, but not works.

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

//recogemos el contenido del nth elemento de la colección de ítems
BNRItem *item = [[[XLItemStore sharedStore] allItems] objectAtIndex:[indexPath row]];

//recogemos la nueva o la celda reciclada
HomepwnerItemCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HomepwnerItemCell"];

//Trying to positioning de UIImageView and not works
[[cell imageView] setCenter:CGPointMake(50, 50)];

//I also try changing its frame, but not works either
[[cell imageView] setFrame:CGRectMake(29, 22, [[item thumbnail] size].width, [[item thumbnail] size].height)];

[cell setController:self];
[cell setTableView:tableView];

//configuramos la celda con el Ítem
[[cell nameLabel] setText:[item itemName]];
[[cell serialNumberLabel] setText:[item serialNumber]];
[[cell valueLabel] setText:[NSString stringWithFormat:@"$%d", [item valueInDollars]]];
[[cell imageView] setImage:[item thumbnail]];

return cell;

}[/code]

Have anyone any idea what I am doing wrong?

Thanks in advance.


#2

It is already resolved. I was trying to set properties of the cell’s imageView instead of the cell’s thumnailView.
In my custom UITableViewCell I have a UIImageView Outlet called thumbnailView, but the UITableViewCell has an imageView by default. So changing this line

To this other line

It works fine. Maybe it’s time to have a break, because these dummy issues happens when you are up to your eyes.


#3

So glad you figured this out. I made the same mistake and it’s been driving me nuts for the last hour trying to figure out why the thumbnailView never moved when I repositioned it on the xib.

Trax