How to add only right border to UIImageView
border, ios, uiimage, uiimageview
Solution
I now did it like
CALayer *sublayer = [CALayer layer];
sublayer.backgroundColor = [UIColor whiteColor].CGColor;
sublayer.frame = CGRectMake(imageView.bounds.size.width, 0, 1, imageView.frame.size.height);
[imageView.layer addSublayer:sublayer];
Problem
I want to add a white border to an UIImageView. I tried the following, but it didn't work: ``` UIImage *image = [UIImage imageNamed:imagePath]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; CGRect rect = imageView.frame; rect.size.width = rect.size.width + 1; // create white right border [imageView setBackgroundColor:[UIColor whiteColor]]; imageView.frame = rect; [myViewView addSubview:imageView]; ```