1

enter image description here

How can do this with cornerRadius and also I'm using UIImageView

Gökhan Çokkeçeci
  • 1,358
  • 3
  • 15
  • 36

3 Answers3

1

All You want to do is

  1. First of all you should Add the QuartzCore.framework through the Click your project-It is in left side of the Navigator Area Then click your project name of the TARGETS(It is below PROJECT-Left Side) Select Build Phases. If you select that you can see the 4 options. Then click Link Binary with Libraries. Once you click that just type Quartzcore. It shows that framework.Then just add it.

  2. Import #import in your relevent view controller.

  3. Do the foollowing code in your .m part

     yourImage.layer.cornerRadius = 5.0; //For Example i give 5.0.So just give your required size.
     yourImage.layer.borderWidth = 3.0f;
     yourImage.layer.borderColor = [UIColor whiteColor].CGColor; //just give the color whatever you want
     yourImage.clipsToBounds = YES;
    

Once it works let me know.

Rivera
  • 10,444
  • 3
  • 53
  • 100
user3182143
  • 9,165
  • 3
  • 28
  • 36
0
  1. One master UIView without set Layer corner
  2. add another UIImageView on it

[view addSubview:imageView];

  1. set the layer corner on the UIImageView
  2. set the frame for the UIImageView (e.g. imageView.frame = CGRectMake(0, -20.f, weight, height);
  3. This should work, if not, set the bounds for the UIView and clipToBounds = YES

If this works, please give me a good one as I am low in points XD

MobileDev
  • 178
  • 2
  • 14
0

To make the circular imageview use this following code in viewDidLoad. For clipped to bounds set it yes

self.MyImageView.layer.cornerRadius = self.MyImageView.frame.size.width / 2;
 self.MyImageView.clipsToBounds = YES;

To apply the border use this code in viewDidLoad

self.MyImageView.layer.borderWidth = 3.0f; 
self.MyImageView.layer.borderColor = [UIColor whiteColor].CGColor;
Nischal Hada
  • 3,120
  • 3
  • 25
  • 54