2

I try to add border around non-square png image with layer.borderColor and CGContextSetStrokeColorWithColor but this result in square border around image not around the real image.

Is there a way to do this ?

sarunw
  • 8,036
  • 11
  • 48
  • 84

1 Answers1

0

If you want a rounded ImageView.

UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@""]];
imageView.layer.borderColor = [UIColor blackColor].CGColor; // Apply Color of your choice
imageView.layer.borderWidth = 2.0;  // Apply width of your choice
imageView.layer.cornerRadius = 50; // Apply radius of your choice
imageView.clipsToBounds = YES;
Abubakr Dar
  • 4,078
  • 4
  • 22
  • 28