This commit is contained in:
Mike Enriquez
2012-01-24 11:27:19 -05:00
commit d993f0fd5a
23 changed files with 1141 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
#Mac OS X Finder and whatnot
.DS_Store
.idea
# Sparkle distribution Private Key (Don't check me in!)
dsa_priv.pem
# XCode (and ancestors) per-user config (very noisy, and not relevant)
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcodeproj/project.xcworkspace/
*.xcodeproj/xcuserdata/

View File

@@ -0,0 +1,334 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
2750E77114CDB0DF007727A0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2750E77014CDB0DF007727A0 /* UIKit.framework */; };
2750E77314CDB0DF007727A0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2750E77214CDB0DF007727A0 /* Foundation.framework */; };
2750E77514CDB0DF007727A0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2750E77414CDB0DF007727A0 /* CoreGraphics.framework */; };
2750E77B14CDB0DF007727A0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2750E77914CDB0DF007727A0 /* InfoPlist.strings */; };
2750E77D14CDB0DF007727A0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E77C14CDB0DF007727A0 /* main.m */; };
2750E78114CDB0DF007727A0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E78014CDB0DF007727A0 /* AppDelegate.m */; };
2750E78814CDB114007727A0 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2750E78714CDB114007727A0 /* Storyboard.storyboard */; };
2750E79414CDB93A007727A0 /* MenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E79314CDB93A007727A0 /* MenuViewController.m */; };
2750E79714CDB959007727A0 /* FirstTopViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E79614CDB959007727A0 /* FirstTopViewController.m */; };
2750E79A14CDB99A007727A0 /* SecondTopViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E79914CDB99A007727A0 /* SecondTopViewController.m */; };
2750E79D14CDBA48007727A0 /* ThirdTopViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E79C14CDBA48007727A0 /* ThirdTopViewController.m */; };
2750E7A014CDBC32007727A0 /* UnderRightViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2750E79F14CDBC32007727A0 /* UnderRightViewController.m */; };
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 */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
2750E76C14CDB0DF007727A0 /* ECSlidingViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ECSlidingViewController.app; sourceTree = BUILT_PRODUCTS_DIR; };
2750E77014CDB0DF007727A0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
2750E77214CDB0DF007727A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
2750E77414CDB0DF007727A0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
2750E77814CDB0DF007727A0 /* ECSlidingViewController-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ECSlidingViewController-Info.plist"; sourceTree = "<group>"; };
2750E77A14CDB0DF007727A0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2750E77C14CDB0DF007727A0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2750E77E14CDB0DF007727A0 /* ECSlidingViewController-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ECSlidingViewController-Prefix.pch"; sourceTree = "<group>"; };
2750E77F14CDB0DF007727A0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
2750E78014CDB0DF007727A0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
2750E78714CDB114007727A0 /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = "<group>"; };
2750E79214CDB93A007727A0 /* MenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuViewController.h; sourceTree = "<group>"; };
2750E79314CDB93A007727A0 /* MenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuViewController.m; sourceTree = "<group>"; };
2750E79514CDB959007727A0 /* FirstTopViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstTopViewController.h; sourceTree = "<group>"; };
2750E79614CDB959007727A0 /* FirstTopViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FirstTopViewController.m; sourceTree = "<group>"; };
2750E79814CDB99A007727A0 /* SecondTopViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondTopViewController.h; sourceTree = "<group>"; };
2750E79914CDB99A007727A0 /* SecondTopViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondTopViewController.m; sourceTree = "<group>"; };
2750E79B14CDBA48007727A0 /* ThirdTopViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThirdTopViewController.h; sourceTree = "<group>"; };
2750E79C14CDBA48007727A0 /* ThirdTopViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThirdTopViewController.m; sourceTree = "<group>"; };
2750E79E14CDBC32007727A0 /* UnderRightViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnderRightViewController.h; sourceTree = "<group>"; };
2750E79F14CDBC32007727A0 /* UnderRightViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnderRightViewController.m; sourceTree = "<group>"; };
2750E7AA14CF1306007727A0 /* ECSlidingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECSlidingViewController.h; sourceTree = "<group>"; };
2750E7AB14CF1306007727A0 /* ECSlidingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ECSlidingViewController.m; sourceTree = "<group>"; };
2750E7AC14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+UIImage_ImageWithUIView.h"; sourceTree = "<group>"; };
2750E7AD14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+UIImage_ImageWithUIView.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2750E76914CDB0DF007727A0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2750E77114CDB0DF007727A0 /* UIKit.framework in Frameworks */,
2750E77314CDB0DF007727A0 /* Foundation.framework in Frameworks */,
2750E77514CDB0DF007727A0 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2750E76114CDB0DF007727A0 = {
isa = PBXGroup;
children = (
2750E77614CDB0DF007727A0 /* ECSlidingViewController */,
2750E76F14CDB0DF007727A0 /* Frameworks */,
2750E76D14CDB0DF007727A0 /* Products */,
);
sourceTree = "<group>";
};
2750E76D14CDB0DF007727A0 /* Products */ = {
isa = PBXGroup;
children = (
2750E76C14CDB0DF007727A0 /* ECSlidingViewController.app */,
);
name = Products;
sourceTree = "<group>";
};
2750E76F14CDB0DF007727A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
2750E77014CDB0DF007727A0 /* UIKit.framework */,
2750E77214CDB0DF007727A0 /* Foundation.framework */,
2750E77414CDB0DF007727A0 /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
2750E77614CDB0DF007727A0 /* ECSlidingViewController */ = {
isa = PBXGroup;
children = (
2750E78A14CDB1CF007727A0 /* Controllers */,
2750E78914CDB1C7007727A0 /* Vendor */,
2750E77F14CDB0DF007727A0 /* AppDelegate.h */,
2750E78014CDB0DF007727A0 /* AppDelegate.m */,
2750E77714CDB0DF007727A0 /* Supporting Files */,
2750E78714CDB114007727A0 /* Storyboard.storyboard */,
);
path = ECSlidingViewController;
sourceTree = "<group>";
};
2750E77714CDB0DF007727A0 /* Supporting Files */ = {
isa = PBXGroup;
children = (
2750E77814CDB0DF007727A0 /* ECSlidingViewController-Info.plist */,
2750E77914CDB0DF007727A0 /* InfoPlist.strings */,
2750E77C14CDB0DF007727A0 /* main.m */,
2750E77E14CDB0DF007727A0 /* ECSlidingViewController-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
2750E78914CDB1C7007727A0 /* Vendor */ = {
isa = PBXGroup;
children = (
2750E7A914CF1306007727A0 /* ECSlidingViewController */,
);
name = Vendor;
sourceTree = "<group>";
};
2750E78A14CDB1CF007727A0 /* Controllers */ = {
isa = PBXGroup;
children = (
2750E79514CDB959007727A0 /* FirstTopViewController.h */,
2750E79614CDB959007727A0 /* FirstTopViewController.m */,
2750E79214CDB93A007727A0 /* MenuViewController.h */,
2750E79314CDB93A007727A0 /* MenuViewController.m */,
2750E79814CDB99A007727A0 /* SecondTopViewController.h */,
2750E79914CDB99A007727A0 /* SecondTopViewController.m */,
2750E79B14CDBA48007727A0 /* ThirdTopViewController.h */,
2750E79C14CDBA48007727A0 /* ThirdTopViewController.m */,
2750E79E14CDBC32007727A0 /* UnderRightViewController.h */,
2750E79F14CDBC32007727A0 /* UnderRightViewController.m */,
);
name = Controllers;
sourceTree = "<group>";
};
2750E7A914CF1306007727A0 /* ECSlidingViewController */ = {
isa = PBXGroup;
children = (
2750E7AA14CF1306007727A0 /* ECSlidingViewController.h */,
2750E7AB14CF1306007727A0 /* ECSlidingViewController.m */,
2750E7AC14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.h */,
2750E7AD14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.m */,
);
name = ECSlidingViewController;
path = Vendor/ECSlidingViewController;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2750E76B14CDB0DF007727A0 /* ECSlidingViewController */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2750E78414CDB0DF007727A0 /* Build configuration list for PBXNativeTarget "ECSlidingViewController" */;
buildPhases = (
2750E76814CDB0DF007727A0 /* Sources */,
2750E76914CDB0DF007727A0 /* Frameworks */,
2750E76A14CDB0DF007727A0 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ECSlidingViewController;
productName = ECSlidingViewController;
productReference = 2750E76C14CDB0DF007727A0 /* ECSlidingViewController.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
2750E76314CDB0DF007727A0 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = 2750E76614CDB0DF007727A0 /* Build configuration list for PBXProject "ECSlidingViewController" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 2750E76114CDB0DF007727A0;
productRefGroup = 2750E76D14CDB0DF007727A0 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
2750E76B14CDB0DF007727A0 /* ECSlidingViewController */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
2750E76A14CDB0DF007727A0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2750E77B14CDB0DF007727A0 /* InfoPlist.strings in Resources */,
2750E78814CDB114007727A0 /* Storyboard.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
2750E76814CDB0DF007727A0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2750E77D14CDB0DF007727A0 /* main.m in Sources */,
2750E78114CDB0DF007727A0 /* AppDelegate.m in Sources */,
2750E79414CDB93A007727A0 /* MenuViewController.m in Sources */,
2750E79714CDB959007727A0 /* FirstTopViewController.m in Sources */,
2750E79A14CDB99A007727A0 /* SecondTopViewController.m in Sources */,
2750E79D14CDBA48007727A0 /* ThirdTopViewController.m in Sources */,
2750E7A014CDBC32007727A0 /* UnderRightViewController.m in Sources */,
2750E7AE14CF1306007727A0 /* ECSlidingViewController.m in Sources */,
2750E7AF14CF1306007727A0 /* UIImage+UIImage_ImageWithUIView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
2750E77914CDB0DF007727A0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
2750E77A14CDB0DF007727A0 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
2750E78214CDB0DF007727A0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
SDKROOT = iphoneos;
};
name = Debug;
};
2750E78314CDB0DF007727A0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
2750E78514CDB0DF007727A0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ECSlidingViewController/ECSlidingViewController-Prefix.pch";
INFOPLIST_FILE = "ECSlidingViewController/ECSlidingViewController-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
2750E78614CDB0DF007727A0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ECSlidingViewController/ECSlidingViewController-Prefix.pch";
INFOPLIST_FILE = "ECSlidingViewController/ECSlidingViewController-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2750E76614CDB0DF007727A0 /* Build configuration list for PBXProject "ECSlidingViewController" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2750E78214CDB0DF007727A0 /* Debug */,
2750E78314CDB0DF007727A0 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
2750E78414CDB0DF007727A0 /* Build configuration list for PBXNativeTarget "ECSlidingViewController" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2750E78514CDB0DF007727A0 /* Debug */,
2750E78614CDB0DF007727A0 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 2750E76314CDB0DF007727A0 /* Project object */;
}

View File

@@ -0,0 +1,16 @@
//
// AppDelegate.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ECSlidingViewController.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View File

@@ -0,0 +1,67 @@
//
// AppDelegate.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize window = _window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
ECSlidingViewController *slidingViewController = (ECSlidingViewController *)self.window.rootViewController;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
slidingViewController.underLeftViewController = [storyboard instantiateViewControllerWithIdentifier:@"Menu"];
slidingViewController.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"FirstTop"];
slidingViewController.anchorRightRevealAmount = 280;
slidingViewController.anchorLeftRevealAmount = 280;
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application
{
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
}
@end

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFiles</key>
<array/>
<key>CFBundleIdentifier</key>
<string>edgecase.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Storyboard</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,14 @@
//
// Prefix header for all source files of the 'ECSlidingViewController' target in the 'ECSlidingViewController' project
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

View File

@@ -0,0 +1,17 @@
//
// FirstTopViewController.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ECSlidingViewController.h"
@interface FirstTopViewController : UIViewController
- (IBAction)revealMenu:(id)sender;
- (IBAction)revealUnderRight:(id)sender;
@end

View File

@@ -0,0 +1,29 @@
//
// FirstTopViewController.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "FirstTopViewController.h"
@implementation FirstTopViewController
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.view addGestureRecognizer:self.slidingViewController.panGesture];
}
- (IBAction)revealMenu:(id)sender
{
[self.slidingViewController anchorToRight];
}
- (IBAction)revealUnderRight:(id)sender
{
[self.slidingViewController anchorToLeft];
}
@end

View File

@@ -0,0 +1,13 @@
//
// MenuViewController.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MenuViewController : UIViewController <UITableViewDataSource, UITabBarControllerDelegate>
@end

View File

@@ -0,0 +1,46 @@
//
// MenuViewController.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "MenuViewController.h"
@interface MenuViewController()
@property (nonatomic, strong) NSArray *menuItems;
@end
@implementation MenuViewController
@synthesize menuItems;
- (void)awakeFromNib
{
self.menuItems = [NSArray arrayWithObjects:@"First", @"Second", @"Third", nil];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sectionIndex
{
return self.menuItems.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"MenuItemCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
cell.textLabel.text = [self.menuItems objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"sup: %@", [self.menuItems objectAtIndex:indexPath.row]);
}
@end

View File

@@ -0,0 +1,13 @@
//
// SecondTopViewController.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SecondTopViewController : UIViewController
@end

View File

@@ -0,0 +1,13 @@
//
// SecondTopViewController.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "SecondTopViewController.h"
@implementation SecondTopViewController
@end

View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1938" systemVersion="11C74" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="H2v-Ob-DhD">
<dependencies>
<development defaultVersion="4200" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="933"/>
</dependencies>
<scenes>
<scene sceneID="cNz-He-b4Z">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="7Zx-U8-fIp" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="Menu" id="Wid-ZD-WEx" customClass="MenuViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="W0P-Wb-YYH">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="35U-4J-jxL">
<rect key="frame" x="0.0" y="0.0" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MenuItemCell" id="Q6b-sq-8AG">
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Wid-ZD-WEx" id="Gc7-Bf-Phn"/>
<outlet property="delegate" destination="Wid-ZD-WEx" id="X3D-ib-PWC"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
</objects>
<point key="canvasLocation" x="-252" y="-287"/>
</scene>
<scene sceneID="jdT-tJ-z4E">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="zjz-eV-f99" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="ThirdTop" id="LsE-e5-Jbi" customClass="ThirdTopViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="UCM-3d-Qlw">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
</objects>
<point key="canvasLocation" x="216" y="-1588"/>
</scene>
<scene sceneID="dCa-Xc-F9L">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="7AE-EV-BdB" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="SecondTop" id="XYc-ji-qQz" customClass="SecondTopViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Z4T-qv-OS6">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
</objects>
<point key="canvasLocation" x="216" y="-942"/>
</scene>
<scene sceneID="FCi-rO-pkm">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="opW-8m-5uU" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="FirstTop" id="fYD-9N-EQW" customClass="FirstTopViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="d8v-Bl-Aef">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" id="MXB-nc-Wa5">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<items>
<navigationItem title="First" id="z7W-L3-FP0">
<barButtonItem key="leftBarButtonItem" title="Menu" id="Ob6-v4-e1S">
<connections>
<action selector="revealMenu:" destination="fYD-9N-EQW" id="jES-cY-WzX"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" title="Right" id="rMo-8V-Mkk">
<connections>
<action selector="revealUnderRight:" destination="fYD-9N-EQW" id="i2i-od-n9T"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
</navigationBar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
</objects>
<point key="canvasLocation" x="216" y="-286"/>
</scene>
<scene sceneID="ALv-FQ-oDv">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="WEj-qL-s8R" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="UnderRight" id="Qdk-8p-DGY" customClass="UnderRightViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="XRA-pX-V7S">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
</objects>
<point key="canvasLocation" x="681" y="-286"/>
</scene>
<scene sceneID="OC6-i3-9aC">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="BIB-pv-C48" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController id="H2v-Ob-DhD" customClass="ECSlidingViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="IWW-TW-Yeo">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
</objects>
<point key="canvasLocation" x="-720" y="-287"/>
</scene>
</scenes>
<classes>
<class className="ECSlidingViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ECSlidingViewController.h"/>
</class>
<class className="FirstTopViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/FirstTopViewController.h"/>
<relationships>
<relationship kind="action" name="revealMenu:"/>
<relationship kind="action" name="revealUnderRight:"/>
</relationships>
</class>
<class className="MenuViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/MenuViewController.h"/>
</class>
<class className="SecondTopViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/SecondTopViewController.h"/>
</class>
<class className="ThirdTopViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/ThirdTopViewController.h"/>
</class>
<class className="UnderRightViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/UnderRightViewController.h"/>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>

View File

@@ -0,0 +1,13 @@
//
// ThirdTopViewController.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ThirdTopViewController : UIViewController
@end

View File

@@ -0,0 +1,13 @@
//
// ThirdTopViewController.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "ThirdTopViewController.h"
@implementation ThirdTopViewController
@end

View File

@@ -0,0 +1,13 @@
//
// UnderRightViewController.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UnderRightViewController : UIViewController
@end

View File

@@ -0,0 +1,13 @@
//
// UnderRightViewController.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "UnderRightViewController.h"
@implementation UnderRightViewController
@end

View File

@@ -0,0 +1,28 @@
//
// ECSlidingViewController.h
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIImage+UIImage_ImageWithUIView.h"
@interface ECSlidingViewController : UIViewController
@property (nonatomic, strong) UIViewController *underLeftViewController;
@property (nonatomic, strong) UIViewController *topViewController;
@property (nonatomic, unsafe_unretained) CGFloat anchorRightRevealAmount;
@property (nonatomic, unsafe_unretained) CGFloat anchorLeftRevealAmount;
@property (nonatomic, strong) UIPanGestureRecognizer *panGesture;
- (void)anchorToRight;
- (void)anchorToLeft;
- (void)reset;
@end
@interface UIViewController(SlidingViewExtension)
- (ECSlidingViewController *)slidingViewController;
@end

View File

@@ -0,0 +1,213 @@
//
// ECSlidingViewController.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import "ECSlidingViewController.h"
@interface ECSlidingViewController()
@property (nonatomic, strong) UIButton *topViewSnapshot;
@property (nonatomic, strong) UITapGestureRecognizer *resetTapGesture;
@property (nonatomic, unsafe_unretained) CGFloat initialTouchPositionX;
@property (nonatomic, unsafe_unretained) CGFloat initialLeftEdgePosition;
- (NSUInteger)autoResizeToFillScreen;
- (UIView *)topView;
- (UIView *)underLeftView;
- (void)updateTopViewLeftEdgePosition:(CGFloat)position;
- (void)addTopViewSnapshot;
- (void)removeTopViewSnapshot;
- (CGFloat)screenWidth;
- (CGFloat)screenWidthForOrientation:(UIInterfaceOrientation)orientation;
- (BOOL)underLeftShowing;
- (BOOL)underRightShowing;
@end
@implementation UIViewController(SlidingViewExtension)
- (ECSlidingViewController *)slidingViewController
{
UIViewController *viewController = self.parentViewController;
while (!(viewController == nil || [viewController isMemberOfClass:[ECSlidingViewController class]])) {
viewController = viewController.parentViewController;
}
return (ECSlidingViewController *)viewController;
}
@end
@implementation ECSlidingViewController
@synthesize underLeftViewController = _underLeftViewController;
@synthesize topViewController = _topViewController;
@synthesize anchorRightRevealAmount;
@synthesize anchorLeftRevealAmount;
@synthesize topViewSnapshot;
@synthesize resetTapGesture;
@synthesize initialTouchPositionX;
@synthesize initialLeftEdgePosition;
@synthesize panGesture;
- (void)setTopViewController:(UIViewController *)theTopViewController
{
_topViewController = theTopViewController;
[_topViewController.view setAutoresizingMask:self.autoResizeToFillScreen];
[_topViewController.view setFrame:self.view.bounds];
[self.view addSubview:_topViewController.view];
}
- (void)setUnderLeftViewController:(UIViewController *)theUnderLeftViewController
{
_underLeftViewController = theUnderLeftViewController;
[_underLeftViewController.view setAutoresizingMask:self.autoResizeToFillScreen];
[_underLeftViewController.view setFrame:self.view.bounds];
[self.view insertSubview:_underLeftViewController.view atIndex:0];
}
- (void)viewDidLoad
{
self.resetTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reset)];
self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(updateTopViewLeftEdgePositionWithRecognizer:)];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self addChildViewController:self.underLeftViewController];
[self.underLeftViewController didMoveToParentViewController:self];
[self addChildViewController:self.topViewController];
[self.topViewController didMoveToParentViewController:self];
}
- (void)updateTopViewLeftEdgePositionWithRecognizer:(UIPanGestureRecognizer *)recognizer
{
CGPoint currentTouchPoint = [recognizer locationInView:self.view];
CGFloat currentTouchPositionX = currentTouchPoint.x;
if (recognizer.state == UIGestureRecognizerStateBegan) {
self.initialTouchPositionX = currentTouchPositionX;
self.initialLeftEdgePosition = self.topView.frame.origin.x;
} else if (recognizer.state == UIGestureRecognizerStateChanged) {
[self updateTopViewLeftEdgePosition:self.initialLeftEdgePosition + currentTouchPositionX - self.initialTouchPositionX];
} else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) {
CGPoint currentVelocityPoint = [recognizer velocityInView:self.view];
CGFloat currentVelocityX = currentVelocityPoint.x;
if ([self underLeftShowing] && currentVelocityX > 100) {
[self anchorToRight];
} else if ([self underRightShowing] && currentVelocityX < 100) {
[self anchorToLeft];
} else {
[self reset];
}
}
}
- (void)anchorToRight
{
[self addTopViewSnapshot];
[self.topView addGestureRecognizer:self.resetTapGesture];
[UIView animateWithDuration:0.25f animations:^{
[self updateTopViewLeftEdgePosition:self.anchorRightRevealAmount];
}];
}
- (void)anchorToLeft
{
[self addTopViewSnapshot];
[self.topView addGestureRecognizer:self.resetTapGesture];
[UIView animateWithDuration:0.25f animations:^{
[self updateTopViewLeftEdgePosition:-self.anchorLeftRevealAmount];
}];
}
- (void)reset
{
[UIView animateWithDuration:0.25f animations:^{
[self updateTopViewLeftEdgePosition:0];
} completion:^(BOOL finished) {
[self.topView removeGestureRecognizer:self.resetTapGesture];
[self removeTopViewSnapshot];
}];
}
- (NSUInteger)autoResizeToFillScreen
{
return (UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin);
}
- (UIView *)topView
{
return self.topViewController.view;
}
- (UIView *)underLeftView
{
return self.underLeftViewController.view;
}
- (void)updateTopViewLeftEdgePosition:(CGFloat)position
{
CGRect frame = self.topView.frame;
frame.origin.x = position;
self.topView.frame = frame;
}
- (void)addTopViewSnapshot
{
if (!self.topViewSnapshot.superview) {
self.topViewSnapshot = [[UIButton alloc] initWithFrame:self.topView.bounds];
[self.topViewSnapshot setImage:[UIImage imageWithUIView:self.topView] forState:(UIControlStateNormal | UIControlStateHighlighted | UIControlStateSelected)];
[self.topView addSubview:self.topViewSnapshot];
}
}
- (void)removeTopViewSnapshot
{
if (self.topViewSnapshot.superview) {
[self.topViewSnapshot removeFromSuperview];
}
}
- (CGFloat)screenWidth
{
return [self screenWidthForOrientation:[UIApplication sharedApplication].statusBarOrientation];
}
- (CGFloat)screenWidthForOrientation:(UIInterfaceOrientation)orientation
{
CGSize size = [UIScreen mainScreen].bounds.size;
UIApplication *application = [UIApplication sharedApplication];
if (UIInterfaceOrientationIsLandscape(orientation))
{
size = CGSizeMake(size.height, size.width);
}
if (application.statusBarHidden == NO)
{
size.height -= MIN(application.statusBarFrame.size.width, application.statusBarFrame.size.height);
}
return size.width;
}
- (BOOL)underLeftShowing
{
return self.topView.frame.origin.x > 0;
}
- (BOOL)underRightShowing
{
return self.topView.frame.origin.x < 0;
}
@end

View File

@@ -0,0 +1,11 @@
//
// UIImage+UIImage_ImageWithUIView.h
// Taken from http://stackoverflow.com/a/7233268
//
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface UIImage (UIImage_ImagewithUIView)
+ (UIImage *)imageWithUIView:(UIView *)view;
@end

View File

@@ -0,0 +1,37 @@
//
// UIImage+UIImage_ImageWithUIView.m
// Taken from http://stackoverflow.com/a/7233268
//
#import "UIImage+UIImage_ImageWithUIView.h"
@implementation UIImage (UIImage_ImagewithUIView)
#pragma mark -
#pragma mark TakeScreenShot
static CGContextRef createBitmapContext(int pixelsWide, int pixelsHigh)
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = (kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
CGContextRef bitmapContext = CGBitmapContextCreate(nil, pixelsWide, pixelsHigh, 8, 0, colorSpace, bitmapInfo);
CGColorSpaceRelease(colorSpace);
return bitmapContext;
}
+ (UIImage *)imageWithUIView:(UIView *)view
{
CGSize screenShotSize = view.bounds.size;
CGContextRef contextRef = createBitmapContext(screenShotSize.width, screenShotSize.height);
CGContextTranslateCTM (contextRef, 0, screenShotSize.height);
CGContextScaleCTM(contextRef, 1, -1);
[view.layer renderInContext:contextRef];
CGImageRef imageRef = CGBitmapContextCreateImage(contextRef);
CGContextRelease(contextRef);
UIImage *img = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
// return the image
return img;
}
@end

View File

@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@@ -0,0 +1,18 @@
//
// main.m
// ECSlidingViewController
//
// Created by Michael Enriquez on 1/23/12.
// Copyright (c) 2012 EdgeCase. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}