Saturday, May 12, 2012

ImageView with Border iPhone

UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
UIImage *img = [UIImage imageNamed:@"image.png"];
imgView.image = img;


imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.layer.cornerRadius = 5;
imageView.layer.borderWidth = 1.0f;
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
CGFloat values[4] = {0.5, 0.5, 0.5, 1.0}; 
CGColorRef grey = CGColorCreate(space, values); 
imageView.layer.borderColor = grey ;
CGColorRelease(grey);
CGColorSpaceRelease(space);

No comments:

Post a Comment