4

can anyone tell me how can I create an image preview inside a customized cell with the aspect of the ones loaded in the mms'.

I've been trying to do it by changing values in IB and I haven't been able to.

Thanks a lot!

alt text
(source: iphonehelp.in)


Thanks for the three answers.

Doing

cell3.imageView.layer.masksToBounds = YES;
cell3.imageView.layer.cornerRadius = 16;
cell3.imageView.layer.borderColor = [UIColor lightGrayColor].CGColor;
cell3.imageView.layer.borderWidth = 1.0; 

I was able to do part of what I want. However, I still can't put that "glow" look on the image. Does anybody now which property should I control?

Thanks a lot (and thanks again).

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
camilo
  • 1,451
  • 3
  • 20
  • 31

3 Answers3

17

Sure. Add the QuartzCore framework to your project, then:

#import <QuartzCore/QuartzCore.h>
// ...
cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.cornerRadius = 4;

Note that the cornerRadius property is only available in OS 3.0 and later; if you're supporting an older version (which you probably don't have to be), you'll need to do some Core Graphics work.

Noah Witherspoon
  • 57,021
  • 16
  • 130
  • 131
0

will creating an image in an image editor and then setting it as the cell's background not work?

This might be useful for you http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

Bryan Clark
  • 203
  • 1
  • 2
  • 10
0

If your image is in an image view and you're targeting OS 3.0+, you can set imageView.layer.cornerRadius.

Ole Begemann
  • 135,006
  • 31
  • 278
  • 256