0

I am drawing mask path on UIView to make it look like a rectangle at a particular point of view. I want to set corner radius for the mask path so that it can appear as bulged at the side like popover of iOS. Any idea how to implement.

Thanks

user2340612
  • 10,053
  • 4
  • 41
  • 66
IOS DEV
  • 1
  • 3
  • http://stackoverflow.com/questions/1509547/uiview-with-rounded-corners – Jagat Dave Jun 06 '16 at 07:16
  • Not Setting Corner radius for view layer. Corner radius for mask path drawn on layer (basically UIBezierPath is a mask path) view.layer.mask = maskPath...... need to set corner radius for mask path drawn – IOS DEV Jun 06 '16 at 07:31
  • Did I understand you right, that you need something like in this post? — http://stackoverflow.com/questions/20442203/uibezierpath-triangle-with-rounded-edges – Andriy Jun 06 '16 at 08:02
  • Thanks Andriy. This is exactly what I was looking for – IOS DEV Jun 06 '16 at 09:19

1 Answers1

1

Use this Code,

Objective C code:

// Cornor radius
[view.layer setCornerRadius:30.0f];
view.layer.masksToBounds = YES;

// border
[view.layer setBorderColor:[UIColor lightGrayColor].CGColor];
[view.layer setBorderWidth:1.5f];

// drop shadow
[view.layer setShadowColor:[UIColor blackColor].CGColor];
[view.layer setShadowOpacity:0.8];
[view.layer setShadowRadius:3.0];
[view.layer setShadowOffset:CGSizeMake(2.0, 2.0)];

Swift Code:

// Cornor radius
    view.layer.cornerRadius = 10.0
    view.layer.masksToBounds = true

// border color and width
    view.layer.borderColor = UIColor.blueColor().CGColor
    view.layer.borderWidth = 2.0

// drop shadow
    view.layer.shadowColor = UIColor.blackColor().CGColor
    view.layer.shadowOpacity = 1.0
    view.layer.shadowRadius = 3.0
    view.layer.shadowOffset = CGSizeMake(2.0, 2.0)

hope its helpful

Iyyappan Ravi
  • 3,205
  • 2
  • 16
  • 30