iosobjective-cios6calayercaanimation

UIImageView with 2 CALayers for border


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.


Solution

  • 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