Reputation: 2226
I have a UIImageView that I am trying to frame with a border, by using CALayer
My border really consists of 2 borders...the inner border will be 5 pixels wide and white, and the outer border will be 1 pixel wide and light gray.
I can accomplish the first part easily with:
myImageView.layer.borderColor = [UIColor whiteColor].CGColor;
myImageView.layer.borderColorWidth = 5.0f;
But I'm struggling to add an additional 1px gray border around that.
Upvotes: 1
Views: 417
Reputation: 4528
Try this
randomView.layer.borderColor = [[UIColor colorWithRed:0.8f green:0.8f blue:0.8f alpha:1.0f] CGColor];
randomView.layer.borderWidth = 1.0f;
Upvotes: 0
Reputation: 4731
you can make a "background view" as a superView of your myImageView
the "background view" is 1px larger than your myImageView
the backgroundColor of "background view" is light gray . Then add your myImageView
as subView
Upvotes: 1