views:

55

answers:

1

Hello, I`m using an Image that is 320x30 using this code :

UIImageView *bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"higlight_cell_mockup.png"]];
[bg setContentMode:UIViewContentModeScaleAspectFit];
cell.backgroundView = bg ;

Problem is, it's still looking like this : alt text

instead of scaling the image up to fill the cell .

Any ideas ?


Edit

This is using :

[bg setContentMode:UIViewContentModeScaleToFill];

alt text

And this is using :

[bg setContentMode:UIViewContentModeScaleAspectFill];

alt text

They vertically scale up better but they BG is still only filling a tiny portion of the cell left of the text, can't get it to fill the entire cell unfortunately ..

A: 

Try to do this sort of resizing which might solve your problem

hib
hmm, getting : warning: 'UIImageView' may not respond to '-drawInRect:'
Julz
import quartz framework #import<QuartCore/QuartzCore.h>
hib
dont apply it on uiimageview it is for uiimage please understand the code.
hib
Ok, I`ll try that.
Julz
But something I find weird, is why would I see just a few pixels by default instead of seeing the full image even if it's not filling the cell ?
Julz
If you want it to fill the cell you should use aspect fill or scale to fill, not aspect fit.
vakio