views:

184

answers:

2

i have the different image with the different size too, i want to put it in cell.imageView.image in every cell, but i want make same size in every cell although the image have the different size, i write this on my code :

UIImage *image = [UIImage imageNamed:imageName];
    cell.imageView.image = image;
    cell.imageView.layer.masksToBounds = YES;
    cell.imageView.layer.cornerRadius = 5.0;

    float sw=image.size.width/cell.imageView.image.size.width;
    float sh=image.size.height/cell.imageView.image.size.height;
    cell.imageView.transform=CGAffineTransformMakeScale(sw, sh);

but it doesn't work, i'am sure that's right.. any body can help me.??alt text

A: 

If your cell is a built in cell, it is supposed that the cell will resize all the images to a fixed, default size. Can you post an screenshot of your application as well?

vodkhang
pardon me, u mean the UITableViewCell screenshot.??
Imam Arief W
yeah, I want the application screenshot. Because all images in table cell should be at the same size
vodkhang
oke,, now how can i put my screenshot in here.??
Imam Arief W
you can edit your question, there is an image button there (with an "image" icon), click on that to upload from your computer
vodkhang
i've uploaded my screenshoot..hope it can be useful..thnx before guys
Imam Arief W
Ok, I understand the problem. In this case, you should try to create your own UITableViewCell. Here is a blog post about that http://www.bdunagan.com/2009/06/28/custom-uitableviewcell-from-a-xib-in-interface-builder/ And after you create UITableViewCell, you can drag a UIImageView with fixed size into
vodkhang
thnx guys for nice share..i'll try it..
Imam Arief W
A: 

I just ran into this same problem. I wanted the photos to be 65 x 65, but they were filling in the size of the UITableViewCell instead. I resolved it by creating the UIImageView programmatically and adding it as a subview to the UITableViewCell. For example:

UIImageView *imageView = [[UIImageView alloc] initWithImage:photo];
imageView.frame = CGRectMake(6.5, 6.5, 65., 65.);
[cell addSubview:imageView];

Edit for clarity: This problem was occurring when I tried to create the UIImageView in Interface Builder. I took it out of Interface Builder and added it programmatically instead.

Sean Hill