mirror of
https://github.com/zhigang1992/ECSlidingViewController.git
synced 2026-03-29 00:18:36 +08:00
Handle shadowPath, shadowOffset, and rotation
This commit is contained in:
@@ -14,12 +14,11 @@
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
self.view.layer.shadowOffset = CGSizeZero;
|
||||
// shadowPath, shadowOffset, and rotation is handled by ECSlidingViewController.
|
||||
// You just need to set the opacity, radius, and color.
|
||||
self.view.layer.shadowOpacity = 0.75f;
|
||||
self.view.layer.shadowRadius = 10.0f;
|
||||
self.view.layer.shadowColor = [UIColor blackColor].CGColor;
|
||||
self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
|
||||
self.view.clipsToBounds = NO;
|
||||
|
||||
if (![self.slidingViewController.underLeftViewController isKindOfClass:[MenuViewController class]]) {
|
||||
self.slidingViewController.underLeftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
|
||||
@@ -32,18 +31,6 @@
|
||||
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
self.view.layer.shadowPath = nil;
|
||||
self.view.layer.shouldRasterize = YES;
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
|
||||
{
|
||||
self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
|
||||
self.view.layer.shouldRasterize = NO;
|
||||
}
|
||||
|
||||
- (IBAction)revealMenu:(id)sender
|
||||
{
|
||||
[self.slidingViewController anchorTopViewTo:ECRight];
|
||||
|
||||
@@ -103,6 +103,8 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
|
||||
|
||||
[_topViewController.view setAutoresizingMask:self.autoResizeToFillScreen];
|
||||
[_topViewController.view setFrame:self.view.bounds];
|
||||
_topViewController.view.layer.shadowOffset = CGSizeZero;
|
||||
_topViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
|
||||
|
||||
[self.view addSubview:_topViewController.view];
|
||||
}
|
||||
@@ -187,6 +189,9 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
|
||||
|
||||
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
self.topView.layer.shadowPath = nil;
|
||||
self.topView.layer.shouldRasterize = YES;
|
||||
|
||||
if(![self topViewHasFocus]){
|
||||
[self removeTopViewSnapshot];
|
||||
}
|
||||
@@ -195,6 +200,9 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
|
||||
self.topView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
|
||||
self.topView.layer.shouldRasterize = NO;
|
||||
|
||||
if(![self topViewHasFocus]){
|
||||
[self addTopViewSnapshot];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user