mirror of
https://github.com/zhigang1992/ECSlidingViewController.git
synced 2026-04-25 05:36:06 +08:00
Improve performance with shadow
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
2750E7AE14CF1306007727A0 /* ECSlidingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E7AB14CF1306007727A0 /* ECSlidingViewController.m */; };
|
||||
2750E7AF14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E7AD14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.m */; };
|
||||
27FC94E014D0C14E0000B18C /* InitialSlidingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27FC94DF14D0C14E0000B18C /* InitialSlidingViewController.m */; };
|
||||
27FC94E314D105C60000B18C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27FC94E214D105C60000B18C /* QuartzCore.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -52,6 +53,7 @@
|
||||
2750E7AD14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+UIImage_ImageWithUIView.m"; sourceTree = "<group>"; };
|
||||
27FC94DE14D0C14E0000B18C /* InitialSlidingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitialSlidingViewController.h; sourceTree = "<group>"; };
|
||||
27FC94DF14D0C14E0000B18C /* InitialSlidingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitialSlidingViewController.m; sourceTree = "<group>"; };
|
||||
27FC94E214D105C60000B18C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -59,6 +61,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
27FC94E314D105C60000B18C /* QuartzCore.framework in Frameworks */,
|
||||
2750E77114CDB0DF007727A0 /* UIKit.framework in Frameworks */,
|
||||
2750E77314CDB0DF007727A0 /* Foundation.framework in Frameworks */,
|
||||
2750E77514CDB0DF007727A0 /* CoreGraphics.framework in Frameworks */,
|
||||
@@ -88,9 +91,10 @@
|
||||
2750E76F14CDB0DF007727A0 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2750E77014CDB0DF007727A0 /* UIKit.framework */,
|
||||
2750E77214CDB0DF007727A0 /* Foundation.framework */,
|
||||
2750E77414CDB0DF007727A0 /* CoreGraphics.framework */,
|
||||
2750E77214CDB0DF007727A0 /* Foundation.framework */,
|
||||
27FC94E214D105C60000B18C /* QuartzCore.framework */,
|
||||
2750E77014CDB0DF007727A0 /* UIKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import "ECSlidingViewController.h"
|
||||
|
||||
@interface FirstTopViewController : UIViewController
|
||||
|
||||
@@ -18,14 +18,25 @@
|
||||
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;
|
||||
|
||||
[self.slidingViewController enablePanningInDirection:ECSlideLeft forView:self.view peekAmount:40.0f];
|
||||
[self.slidingViewController enablePanningInDirection:ECSlideRight forView:self.view peekAmount:40.0f];
|
||||
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
|
||||
self.slidingViewController.underRightViewController = [storyboard instantiateViewControllerWithIdentifier:@"UnderRight"];
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
// if going from portrait to landscape or landscape to portrait
|
||||
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation) != UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {
|
||||
CGRect bounds = self.view.layer.bounds;
|
||||
self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(bounds.origin.y, bounds.origin.x, bounds.size.height, bounds.size.width)].CGPath;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)revealMenu:(id)sender
|
||||
{
|
||||
[self.slidingViewController slideInDirection:ECSlideRight peekAmount:40.0f onComplete:nil];
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
}
|
||||
|
||||
center.x = newHorizontalCenter;
|
||||
self.topView.center = center;
|
||||
self.topView.layer.position = center;
|
||||
|
||||
if (newHorizontalCenter == self.resettedCenter) {
|
||||
[self topDidReset];
|
||||
@@ -301,9 +301,7 @@
|
||||
{
|
||||
[self addTopViewSnapshot];
|
||||
[self.topView addGestureRecognizer:self.resetTapGesture];
|
||||
if (self.underRightViewController) {
|
||||
self.underRightView.hidden = YES;
|
||||
}
|
||||
self.underRightView.hidden = YES;
|
||||
self.underLeftView.hidden = NO;
|
||||
}
|
||||
|
||||
@@ -311,9 +309,7 @@
|
||||
{
|
||||
[self addTopViewSnapshot];
|
||||
[self.topView addGestureRecognizer:self.resetTapGesture];
|
||||
if (self.underLeftViewController) {
|
||||
self.underLeftView.hidden = YES;
|
||||
}
|
||||
self.underLeftView.hidden = YES;
|
||||
self.underRightView.hidden = NO;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user