I have a scrollView which has an origin.y = -200
, size.height = 200
and contentSize.height = 270
.
On the main view I have a tableView
with the touch of a button
. the scrollView
animates from the top to origin.y = 64
. Because the scrollView
and tableView
share the same color background, I want a shadow outside the the scrollView
to make the views separate.
But when I set the scrollView.layer.masksToBounds = YES
it automatically expands to its full contentSize
which is 270. If I comment out the maskToBounds
I get no shadow. What am I missing? Thank you in advance
_addScroller.layer.shadowColor = [UIColor blackColor].CGColor;
_addScroller.layer.shadowOffset = CGSizeMake(0, 2);
_addScroller.layer.shadowOpacity = .7f;
_addScroller.layer.shadowRadius = 2;
// _addScroller.layer.masksToBounds = NO;
CGPathRef path = [UIBezierPath bezierPathWithRect:_addScroller.frame].CGPath;
_addScroller.layer.shadowPath = path;
This is with masksToBounds = NO;
it automatically sets the frame.height to the contentSize.height