I'm building an ios application. In my application I have a view which contains amongst other things an ImageView I've created a border around the image view by adding subviews around it. Each subview has got it's own unique values (5,10,15,10)
I give my users the ability to move, rotate and scale the super view. Currently every scale causes my border views to change as well. I want the borders around the interior image to remain in the same original, unscaled size.
As you can see in the screenshot, I have two UIViews. They both have the same shadow border (see code) The first one is scaled X 2. The result is not only a scaled view, but also a scaled shadow. My question is, how can I scale only the view, and not its shadow.
view.layer.MasksToBounds = false;
view.layer.ShadowColor = [[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:0.5].CGColor;
view.layer.ShadowOpacity = 0.5f;
view.layer.shadowRadius = 1.0f;
view.layer.ShadowOffset = CGSizeMake(0, 2.5f);
UIBezierPath * depthShadowPath = [UIBezierPath bezierPath ];
[depthShadowPath moveToPoint:CGPointMake( -border , -border ) ];
[depthShadowPath addLineToPoint:CGPointMake( view.frame.size.width + border , -border ) ];
[depthShadowPath addLineToPoint:CGPointMake( view.frame.size.width + border , view.frame.size.height + border) ];
[depthShadowPath addLineToPoint:CGPointMake( -border , view.frame.size.height + border ) ];
[depthShadowPath addLineToPoint:CGPointMake( -border , -border) ];
[view.layer setShadowPath:[depthShadowPath CGPath ] ];
How can this be done?