From 67b10ed63facb66f4bf5afface44d8e521ef2a89 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 9 Dec 2010 10:16:24 -0800 Subject: [PATCH 01/23] --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index e55e2be..72c1a6c 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ #Leaves -Leaves is an simple way to present a page-turning interface similar to Apple's iBooks. It comprises two classes, `LeavesView` and `LeavesViewController`, and occupies less than 100 kB compiled. It uses only public APIs, sacrificing a portion of iBooks' visual flair to ensure that your application is safe for submission to the App Store. +Leaves is a simple way to present a page-turning interface similar to Apple's iBooks. It comprises two classes, `LeavesView` and `LeavesViewController`, and occupies less than 100 kB compiled. It uses only public APIs, sacrificing a portion of iBooks' visual flair to ensure that your application is safe for submission to the App Store. Leaves supports: From 609abdc2d94cacef08bf56e8bd4006ee2ef5961e Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 15:20:59 -0500 Subject: [PATCH 02/23] gitignore more Xcode leavings --- .gitignore | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d676377..301b7e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,21 @@ -# xcode noise +# Xcode build/* *.pbxuser +!default.pbxuser *.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +*.xcworkspace +!default.xcworkspace +xcuserdata +profile +*.moved-aside # old skool .svn # osx noise .DS_Store -profile From 5cf2af4887f42cb7a266ba80468a64c5ab5fd88e Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 15:21:31 -0500 Subject: [PATCH 03/23] these belong in the global gitignore --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index 301b7e6..edc082c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,9 +13,3 @@ build/* xcuserdata profile *.moved-aside - -# old skool -.svn - -# osx noise -.DS_Store From 27e4dd5c50c674177d351006cc55937ce412e29e Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 15:27:39 -0500 Subject: [PATCH 04/23] update settings per Xcode 5 recommendations --- Leaves.xcodeproj/project.pbxproj | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Leaves.xcodeproj/project.pbxproj b/Leaves.xcodeproj/project.pbxproj index f0eb30e..805eba6 100755 --- a/Leaves.xcodeproj/project.pbxproj +++ b/Leaves.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -200,11 +200,16 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { + LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Tom Brow"; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Leaves" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + en, + ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; projectRoot = ""; @@ -255,7 +260,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -263,7 +267,7 @@ GCC_PREFIX_HEADER = Leaves_Prefix.pch; INFOPLIST_FILE = "Leaves-Info.plist"; PRODUCT_NAME = Leaves; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -272,13 +276,12 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Leaves_Prefix.pch; INFOPLIST_FILE = "Leaves-Info.plist"; PRODUCT_NAME = Leaves; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -287,27 +290,26 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; - SDKROOT = iphoneos3.0; + SDKROOT = iphoneos; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PREBINDING = NO; - SDKROOT = iphoneos3.0; + SDKROOT = iphoneos; }; name = Release; }; From 37cff3e2365a57e07a1b6d6f7c19968a74065c8f Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 15:48:14 -0500 Subject: [PATCH 05/23] use proper format for unsigned long --- Classes/PDFExampleViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/PDFExampleViewController.m b/Classes/PDFExampleViewController.m index 6142acd..6da3a00 100644 --- a/Classes/PDFExampleViewController.m +++ b/Classes/PDFExampleViewController.m @@ -27,7 +27,7 @@ - (void)dealloc { - (void) displayPageNumber:(NSUInteger)pageNumber { self.navigationItem.title = [NSString stringWithFormat: - @"Page %u of %u", + @"Page %u of %lu", pageNumber, CGPDFDocumentGetNumberOfPages(pdf)]; } From 4198849f800c72a8fa748986374608ee6eba2a58 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 15:48:59 -0500 Subject: [PATCH 06/23] declare writable properties nonatomic --- Leaves/LeavesCache.h | 2 +- Leaves/LeavesView.h | 4 ++-- Leaves/LeavesView.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Leaves/LeavesCache.h b/Leaves/LeavesCache.h index 7ee3e4a..322a41e 100644 --- a/Leaves/LeavesCache.h +++ b/Leaves/LeavesCache.h @@ -16,7 +16,7 @@ CGSize pageSize; } -@property (assign) CGSize pageSize; +@property (nonatomic, assign) CGSize pageSize; @property (assign) id dataSource; - (id) initWithPageSize:(CGSize)aPageSize; diff --git a/Leaves/LeavesView.h b/Leaves/LeavesView.h index 709db1f..f0acf11 100644 --- a/Leaves/LeavesView.h +++ b/Leaves/LeavesView.h @@ -49,10 +49,10 @@ @property (readonly) CGFloat targetWidth; // set this to a nonzero value to get a targetWidth other than the default -@property (assign) CGFloat preferredTargetWidth; +@property (nonatomic, assign) CGFloat preferredTargetWidth; // the zero-based index of the page currently being displayed. -@property (assign) NSUInteger currentPageIndex; +@property (nonatomic, assign) NSUInteger currentPageIndex; // If backgroundRendering is YES, some pages not currently being displayed will be pre-rendered in background threads. // The default value is NO. Only set this to YES if your implementation of the data source methods is thread-safe. diff --git a/Leaves/LeavesView.m b/Leaves/LeavesView.m index 6a6ee11..fa5a400 100644 --- a/Leaves/LeavesView.m +++ b/Leaves/LeavesView.m @@ -10,7 +10,7 @@ @interface LeavesView () -@property (assign) CGFloat leafEdge; +@property (nonatomic, assign) CGFloat leafEdge; @end From ed9ed041918414ab546ac7f5ff986a7e025cb7a8 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 15:50:10 -0500 Subject: [PATCH 07/23] add placeholder Default image for 4" Retina --- Default-568h@2x.png | Bin 0 -> 18594 bytes Leaves.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 Default-568h@2x.png diff --git a/Default-568h@2x.png b/Default-568h@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0891b7aabfcf3422423b109c8beed2bab838c607 GIT binary patch literal 18594 zcmeI4X;f257Jx&9fS`ixvS;&$x8J@slQFSel)6zJN=?13FB7H(lQjRkSy8x_-S~tvu2gzn1oS+dLcF#eqtq$ z%tf9TTvX?`)R@}3uBI;jzS-=ZR-Td&MHaS&;!0?Ni*#$#`n*~CcQK)Q9vAQ~TUpnI!j)a2biYK^R)M~A5wUDZhx?ULMX z3x1P&qt=trOY6P2U67L=m=U?F|5#Uj(eCueNTZaHs_ceWiHeET+j+tp3Jt9g(ekqP z2WOvfR{qV+9r+o4J5?qK>7;;^+I7tGv-i)es$X_D=EoKF+S?zsyj^oRFElP}c}JT< zd8SUs-?O?}2YD#ngKbnHgzHBcboxK_2r9l(?eNCl-pEzkJm}fY?WC*jnS?VBE4EpY zO$fEejz6fU;W2Kl>JeQBZBl-%Irg`obSlg*@4QB;Dd1H7^Oi5wvt4d{RZ!8Og?^aE z)k0$1g+V3fd(gdQ3d&q2q-FL*uy#}|bc^=VhFsl0jBgUGJ+-s3U8MK9A!YJJMxpci z5hJ%|{DwV48fZn0{n5l$N_KcSb#NKE4plB`9I6Zt=Z!~-zw0{9tg$L&Ju1F0X)Cy8 zKF;(&lJ>x)Jw(=;p~sF(Sd9VWGwFE2rnyS9!f^DZ8+aCLq zQ};>lcJ1GDLqjm6Hd>|Eabno@P`~Bn(~6^aD_#yoEH(a?Nm1S<;S+hSxI5d16^<1lEM3NPFi zkqPrpL)+ zgnseFikg`gJVBha1&7C4;O6>h=dt~`ND+;Zd?W(4v2JIb7Pt>Td42%M-Ju-XAH#Pns762L}K3 zDhvsRqN0Ni(1UrishD2YvV?4*h2iFj$+&N||Fn$4n|^NSU+o?~jq`0jVQt8T9l{7b zXiwwODFh2V!Q6sqP9S>WH$oOf$N~=d0-bqTlD61!=`&0eAP-F>XN?*|gtOXX{ zQVTWyYo4ZK0GAw!GHf|pz9`D;-bbb*5LBX*{bnz|+)$@&P9|ORM2o?95{;ejvo&r- zq8cBhTN6nn)7~W>54U)%-F_-b?YKdfk5I8MHcuzBD5)!;yv#Z&R&^y=@=>VTIMy#r zX&U<=BsPkdqcMe<_}2+>H%XKyrr5ZR8_KVe>ZqYN z^=^~TFD};;rHJ$U;{~w^hYojl4hRI@SH$^K{YEo=sg)WY87r!*7blQK&qnpDo0`Vn zkl)9u9g=mCh&ZCJS(L4yN3k0kQ zuvg$h2KEEk51T+O0JQ+r0`R>g{jvqM0Mr6d3qUOZwE!?PI7HY@CE|dr sfw?Q;rAv?G4&^^8-z_>&sWXMxvD*gPOU4CBe-*@OtE+wfmVJNyHv)PfH~;_u literal 0 HcmV?d00001 diff --git a/Leaves.xcodeproj/project.pbxproj b/Leaves.xcodeproj/project.pbxproj index 805eba6..781537c 100755 --- a/Leaves.xcodeproj/project.pbxproj +++ b/Leaves.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ D33D4F01117D8EAE00BA7203 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4F00117D8EAE00BA7203 /* main.m */; }; D33D4F41117E244C00BA7203 /* ExamplesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4F40117E244C00BA7203 /* ExamplesViewController.m */; }; D33D5176117E780300BA7203 /* ProceduralExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D5175117E780300BA7203 /* ProceduralExampleViewController.m */; }; + EA64660717E7A6490060CB7C /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = EA64660617E7A6490060CB7C /* Default-568h@2x.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -62,6 +63,7 @@ D33D4F40117E244C00BA7203 /* ExamplesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExamplesViewController.m; sourceTree = ""; }; D33D5174117E780300BA7203 /* ProceduralExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProceduralExampleViewController.h; sourceTree = ""; }; D33D5175117E780300BA7203 /* ProceduralExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProceduralExampleViewController.m; sourceTree = ""; }; + EA64660617E7A6490060CB7C /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../Default-568h@2x.png"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -164,6 +166,7 @@ D33D4EC4117D8D4500BA7203 /* Resources */ = { isa = PBXGroup; children = ( + EA64660617E7A6490060CB7C /* Default-568h@2x.png */, D33D4EDA117D8DCD00BA7203 /* Leaves-Info.plist */, D33D4EC9117D8D4500BA7203 /* MainWindow.xib */, D33D4EC5117D8D4500BA7203 /* kitten.jpg */, @@ -229,6 +232,7 @@ D33D4ECE117D8D4500BA7203 /* kitten2.jpg in Resources */, D33D4ECF117D8D4500BA7203 /* kitten3.jpg in Resources */, D33D4ED1117D8D4500BA7203 /* MainWindow.xib in Resources */, + EA64660717E7A6490060CB7C /* Default-568h@2x.png in Resources */, D33D4ED2117D8D4500BA7203 /* paper.pdf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; From 326930bc8cdd59bc9250ae8b676e2a5ade36887c Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 16 Sep 2013 16:04:13 -0500 Subject: [PATCH 08/23] set the app window's root view controller --- Classes/LeavesAppDelegate.h | 1 - Classes/LeavesAppDelegate.m | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Classes/LeavesAppDelegate.h b/Classes/LeavesAppDelegate.h index 8bd67da..3dc9843 100644 --- a/Classes/LeavesAppDelegate.h +++ b/Classes/LeavesAppDelegate.h @@ -12,7 +12,6 @@ @interface LeavesAppDelegate : NSObject { UIWindow *window; - UIViewController *viewController; } @property (nonatomic, retain) IBOutlet UIWindow *window; diff --git a/Classes/LeavesAppDelegate.m b/Classes/LeavesAppDelegate.m index 2f55456..a744633 100644 --- a/Classes/LeavesAppDelegate.m +++ b/Classes/LeavesAppDelegate.m @@ -15,9 +15,7 @@ @implementation LeavesAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIViewController *rootViewController = [[[ExamplesViewController alloc] init] autorelease]; - viewController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; - - [window addSubview:viewController.view]; + window.rootViewController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; [window makeKeyAndVisible]; return YES; @@ -25,7 +23,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( - (void)dealloc { - [viewController release]; [window release]; [super dealloc]; } From b4f6f23e96f1e2803275e6353e20fa945498fdeb Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Tue, 17 Sep 2013 13:28:26 -0500 Subject: [PATCH 09/23] don't attempt to render pages at size (0, 0) --- Leaves/LeavesCache.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Leaves/LeavesCache.m b/Leaves/LeavesCache.m index c8ba486..56f80b1 100644 --- a/Leaves/LeavesCache.m +++ b/Leaves/LeavesCache.m @@ -31,6 +31,9 @@ - (void) dealloc - (CGImageRef) imageForPageIndex:(NSUInteger)pageIndex { + if (CGSizeEqualToSize(pageSize, CGSizeZero)) + return NULL; + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, pageSize.width, @@ -61,10 +64,12 @@ - (CGImageRef) cachedImageForPageIndex:(NSUInteger)pageIndex { } if (!pageImage) { CGImageRef pageCGImage = [self imageForPageIndex:pageIndex]; - pageImage = [UIImage imageWithCGImage:pageCGImage]; - @synchronized (pageCache) { - [pageCache setObject:pageImage forKey:pageIndexNumber]; - } + if (pageCGImage) { + pageImage = [UIImage imageWithCGImage:pageCGImage]; + @synchronized (pageCache) { + [pageCache setObject:pageImage forKey:pageIndexNumber]; + } + } } return pageImage.CGImage; } From 5e0b78a622011861ac1efb3843f546aaafa4a9bf Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Wed, 18 Sep 2013 19:32:59 -0500 Subject: [PATCH 10/23] specify a deployment target --- Leaves.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Leaves.xcodeproj/project.pbxproj b/Leaves.xcodeproj/project.pbxproj index 781537c..80c2465 100755 --- a/Leaves.xcodeproj/project.pbxproj +++ b/Leaves.xcodeproj/project.pbxproj @@ -298,6 +298,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.2; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; SDKROOT = iphoneos; @@ -311,6 +312,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.2; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; PREBINDING = NO; SDKROOT = iphoneos; From f7277b1c2dceec9f00d3a24d4bbfd154eb82c0fa Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Wed, 18 Sep 2013 20:14:08 -0500 Subject: [PATCH 11/23] clean up LeavesViewController header --- Classes/PDFExampleViewController.m | 3 +- Leaves/LeavesViewController.h | 10 ++---- Leaves/LeavesViewController.m | 50 ++++++++++++------------------ 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/Classes/PDFExampleViewController.m b/Classes/PDFExampleViewController.m index 6da3a00..dd7d034 100644 --- a/Classes/PDFExampleViewController.m +++ b/Classes/PDFExampleViewController.m @@ -8,6 +8,7 @@ #import "PDFExampleViewController.h" #import "Utilities.h" +#import "LeavesView.h" @implementation PDFExampleViewController @@ -56,7 +57,7 @@ - (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { - (void) viewDidLoad { [super viewDidLoad]; - leavesView.backgroundRendering = YES; + self.leavesView.backgroundRendering = YES; [self displayPageNumber:1]; } diff --git a/Leaves/LeavesViewController.h b/Leaves/LeavesViewController.h index cb22dc5..5744489 100644 --- a/Leaves/LeavesViewController.h +++ b/Leaves/LeavesViewController.h @@ -7,16 +7,12 @@ // #import -#import "LeavesView.h" -@interface LeavesViewController : UIViewController { - LeavesView *leavesView; -} +@class LeavesView; -// added by Lnkd.com?24 - use designated initializer to avoid continuous loop when loaded from NIB -- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle; +@interface LeavesViewController : UIViewController -- (id)init; +@property (readonly) LeavesView *leavesView; @end diff --git a/Leaves/LeavesViewController.m b/Leaves/LeavesViewController.m index 29b68c4..4b4aee7 100644 --- a/Leaves/LeavesViewController.m +++ b/Leaves/LeavesViewController.m @@ -7,32 +7,26 @@ // #import "LeavesViewController.h" +#import "LeavesView.h" -@implementation LeavesViewController - -- (void) initialize { - leavesView = [[LeavesView alloc] initWithFrame:CGRectZero]; -} +@interface LeavesViewController () -- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle -{ - if (self = [super initWithNibName:nibName bundle:nibBundle]) { - [self initialize]; - } - return self; -} +@end -- (id)init { - return [self initWithNibName:nil bundle:nil]; -} +@implementation LeavesViewController -- (void) awakeFromNib { - [super awakeFromNib]; - [self initialize]; +- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { + if (self = [super initWithNibName:nibName bundle:nibBundle]) { + _leavesView = [[LeavesView alloc] initWithFrame:CGRectZero]; + _leavesView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + _leavesView.dataSource = self; + _leavesView.delegate = self; + } + return self; } - (void)dealloc { - [leavesView release]; + [_leavesView release]; [super dealloc]; } @@ -46,20 +40,14 @@ - (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { } -#pragma mark UIViewController methods - -- (void)loadView { - [super loadView]; - leavesView.frame = self.view.bounds; - leavesView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; - [self.view addSubview:leavesView]; -} +#pragma mark UIViewController methods -- (void) viewDidLoad { +- (void)viewDidLoad { [super viewDidLoad]; - leavesView.dataSource = self; - leavesView.delegate = self; - [leavesView reloadData]; + + _leavesView.frame = self.view.bounds; + [self.view addSubview:_leavesView]; + [_leavesView reloadData]; } @end From d195bcf0d1e71e6eab6803e4c97f3fbb3e48c106 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Wed, 18 Sep 2013 20:19:27 -0500 Subject: [PATCH 12/23] refactor example --- Classes/PDFExampleViewController.m | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Classes/PDFExampleViewController.m b/Classes/PDFExampleViewController.m index dd7d034..5966d6b 100644 --- a/Classes/PDFExampleViewController.m +++ b/Classes/PDFExampleViewController.m @@ -15,8 +15,11 @@ @implementation PDFExampleViewController - (id)init { if (self = [super init]) { CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("paper.pdf"), NULL, NULL); - pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL); + pdf = CGPDFDocumentCreateWithURL(pdfURL); CFRelease(pdfURL); + + self.leavesView.backgroundRendering = YES; + [self displayPageNumber:1]; } return self; } @@ -53,12 +56,4 @@ - (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { CGContextDrawPDFPage(ctx, page); } -#pragma mark UIViewController - -- (void) viewDidLoad { - [super viewDidLoad]; - self.leavesView.backgroundRendering = YES; - [self displayPageNumber:1]; -} - @end From 5afc766cd57d039cdc87bd49f3a2dd585e73cecf Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Wed, 18 Sep 2013 23:44:33 -0500 Subject: [PATCH 13/23] update code style --- Classes/ExamplesViewController.h | 4 +- Classes/ExamplesViewController.m | 36 ++- Classes/ImageExampleViewController.h | 4 +- Classes/ImageExampleViewController.m | 28 +- Classes/LeavesAppDelegate.h | 8 +- Classes/LeavesAppDelegate.m | 9 +- Classes/PDFExampleViewController.h | 4 +- Classes/PDFExampleViewController.m | 28 +- Classes/ProceduralExampleViewController.h | 5 +- Classes/ProceduralExampleViewController.m | 6 +- Leaves/LeavesCache.h | 16 +- Leaves/LeavesCache.m | 68 ++--- Leaves/LeavesView.h | 43 +-- Leaves/LeavesView.m | 307 +++++++++++----------- Leaves/LeavesViewController.m | 8 +- 15 files changed, 270 insertions(+), 304 deletions(-) diff --git a/Classes/ExamplesViewController.h b/Classes/ExamplesViewController.h index 8e9d1f3..8fe06c5 100644 --- a/Classes/ExamplesViewController.h +++ b/Classes/ExamplesViewController.h @@ -8,8 +8,6 @@ #import - -@interface ExamplesViewController : UITableViewController { -} +@interface ExamplesViewController : UITableViewController @end diff --git a/Classes/ExamplesViewController.m b/Classes/ExamplesViewController.m index 886702e..305288d 100644 --- a/Classes/ExamplesViewController.m +++ b/Classes/ExamplesViewController.m @@ -11,21 +11,17 @@ #import "ImageExampleViewController.h" #import "ProceduralExampleViewController.h" -enum {PDF, IMAGE, PROCEDURAL, NUM_EXAMPLES}; +enum {ExamplePDF, ExampleImage, ExampleProcedural, NumExamples}; @implementation ExamplesViewController - (id)init { - if ((self = [super initWithStyle:UITableViewStyleGrouped])) { + if (self = [super initWithStyle:UITableViewStyleGrouped]) { } return self; } -- (void)dealloc { - [super dealloc]; -} - -#pragma mark UITableViewDataSource methods +#pragma mark UITableViewDataSource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; @@ -33,11 +29,9 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return NUM_EXAMPLES; + return NumExamples; } - -// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; @@ -48,32 +42,34 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } switch (indexPath.row) { - case PDF: cell.textLabel.text = @"PDF example"; break; - case IMAGE: cell.textLabel.text = @"Image example"; break; - case PROCEDURAL: cell.textLabel.text = @"Procedural example"; break; + case ExamplePDF: cell.textLabel.text = @"PDF example"; break; + case ExampleImage: cell.textLabel.text = @"Image example"; break; + case ExampleProcedural: cell.textLabel.text = @"Procedural example"; break; default: cell.textLabel.text = @""; } return cell; } -#pragma mark UITableViewDelegate methods +#pragma mark UITableViewDelegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UIViewController *viewController; switch (indexPath.row) { - case PDF: + case ExamplePDF: viewController = [[[PDFExampleViewController alloc] init] autorelease]; break; - case IMAGE: + case ExampleImage: viewController = [[[ImageExampleViewController alloc] init] autorelease]; break; - case PROCEDURAL: + case ExampleProcedural: viewController = [[[ProceduralExampleViewController alloc] init] autorelease]; break; default: - viewController = [[[UIViewController alloc] init] autorelease]; - } - [self.navigationController pushViewController:viewController animated:YES]; + viewController = nil; + } + + if (viewController) + [self.navigationController pushViewController:viewController animated:YES]; } diff --git a/Classes/ImageExampleViewController.h b/Classes/ImageExampleViewController.h index 735e65e..f5c677a 100644 --- a/Classes/ImageExampleViewController.h +++ b/Classes/ImageExampleViewController.h @@ -8,8 +8,6 @@ #import "LeavesViewController.h" -@interface ImageExampleViewController : LeavesViewController { - NSArray *images; -} +@interface ImageExampleViewController : LeavesViewController @end diff --git a/Classes/ImageExampleViewController.m b/Classes/ImageExampleViewController.m index 5e407f0..afb12df 100644 --- a/Classes/ImageExampleViewController.m +++ b/Classes/ImageExampleViewController.m @@ -9,32 +9,38 @@ #import "ImageExampleViewController.h" #import "Utilities.h" +@interface ImageExampleViewController () + +@property (readonly) NSArray *images; + +@end + @implementation ImageExampleViewController - (id)init { if (self = [super init]) { - images = [[NSArray alloc] initWithObjects: - [UIImage imageNamed:@"kitten.jpg"], - [UIImage imageNamed:@"kitten2.jpg"], - [UIImage imageNamed:@"kitten3.jpg"], - nil]; + _images = [[NSArray alloc] initWithObjects: + [UIImage imageNamed:@"kitten.jpg"], + [UIImage imageNamed:@"kitten2.jpg"], + [UIImage imageNamed:@"kitten3.jpg"], + nil]; } return self; } - (void)dealloc { - [images release]; + [_images release]; [super dealloc]; } -#pragma mark LeavesViewDataSource methods +#pragma mark LeavesViewDataSource -- (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView { - return images.count; +- (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView { + return _images.count; } -- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { - UIImage *image = [images objectAtIndex:index]; +- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { + UIImage *image = [_images objectAtIndex:index]; CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height); CGAffineTransform transform = aspectFit(imageRect, CGContextGetClipBoundingBox(ctx)); diff --git a/Classes/LeavesAppDelegate.h b/Classes/LeavesAppDelegate.h index 3dc9843..d0cf5c3 100644 --- a/Classes/LeavesAppDelegate.h +++ b/Classes/LeavesAppDelegate.h @@ -8,13 +8,7 @@ #import -@class LeavesViewController; - -@interface LeavesAppDelegate : NSObject { - UIWindow *window; -} - -@property (nonatomic, retain) IBOutlet UIWindow *window; +@interface LeavesAppDelegate : NSObject @end diff --git a/Classes/LeavesAppDelegate.m b/Classes/LeavesAppDelegate.m index a744633..de84fe5 100644 --- a/Classes/LeavesAppDelegate.m +++ b/Classes/LeavesAppDelegate.m @@ -11,19 +11,18 @@ @implementation LeavesAppDelegate -@synthesize window; +@synthesize window=_window; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIViewController *rootViewController = [[[ExamplesViewController alloc] init] autorelease]; - window.rootViewController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; - [window makeKeyAndVisible]; + self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; + [self.window makeKeyAndVisible]; return YES; } - - (void)dealloc { - [window release]; + [_window release]; [super dealloc]; } diff --git a/Classes/PDFExampleViewController.h b/Classes/PDFExampleViewController.h index 40a1119..ff26209 100644 --- a/Classes/PDFExampleViewController.h +++ b/Classes/PDFExampleViewController.h @@ -8,8 +8,6 @@ #import "LeavesViewController.h" -@interface PDFExampleViewController : LeavesViewController { - CGPDFDocumentRef pdf; -} +@interface PDFExampleViewController : LeavesViewController @end diff --git a/Classes/PDFExampleViewController.m b/Classes/PDFExampleViewController.m index 5966d6b..a8a97a6 100644 --- a/Classes/PDFExampleViewController.m +++ b/Classes/PDFExampleViewController.m @@ -10,12 +10,18 @@ #import "Utilities.h" #import "LeavesView.h" +@interface PDFExampleViewController () + +@property (readonly) CGPDFDocumentRef pdf; + +@end + @implementation PDFExampleViewController - (id)init { if (self = [super init]) { CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("paper.pdf"), NULL, NULL); - pdf = CGPDFDocumentCreateWithURL(pdfURL); + _pdf = CGPDFDocumentCreateWithURL(pdfURL); CFRelease(pdfURL); self.leavesView.backgroundRendering = YES; @@ -25,31 +31,31 @@ - (id)init { } - (void)dealloc { - CGPDFDocumentRelease(pdf); + CGPDFDocumentRelease(_pdf); [super dealloc]; } -- (void) displayPageNumber:(NSUInteger)pageNumber { +- (void)displayPageNumber:(NSUInteger)pageNumber { self.navigationItem.title = [NSString stringWithFormat: @"Page %u of %lu", pageNumber, - CGPDFDocumentGetNumberOfPages(pdf)]; + CGPDFDocumentGetNumberOfPages(_pdf)]; } -#pragma mark LeavesViewDelegate methods +#pragma mark LeavesViewDelegate -- (void) leavesView:(LeavesView *)leavesView willTurnToPageAtIndex:(NSUInteger)pageIndex { +- (void)leavesView:(LeavesView *)leavesView willTurnToPageAtIndex:(NSUInteger)pageIndex { [self displayPageNumber:pageIndex + 1]; } -#pragma mark LeavesViewDataSource methods +#pragma mark LeavesViewDataSource -- (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView { - return CGPDFDocumentGetNumberOfPages(pdf); +- (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView { + return CGPDFDocumentGetNumberOfPages(_pdf); } -- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { - CGPDFPageRef page = CGPDFDocumentGetPage(pdf, index + 1); +- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { + CGPDFPageRef page = CGPDFDocumentGetPage(_pdf, index + 1); CGAffineTransform transform = aspectFit(CGPDFPageGetBoxRect(page, kCGPDFMediaBox), CGContextGetClipBoundingBox(ctx)); CGContextConcatCTM(ctx, transform); diff --git a/Classes/ProceduralExampleViewController.h b/Classes/ProceduralExampleViewController.h index 1f93d01..3cc70f1 100644 --- a/Classes/ProceduralExampleViewController.h +++ b/Classes/ProceduralExampleViewController.h @@ -8,9 +8,6 @@ #import "LeavesViewController.h" - -@interface ProceduralExampleViewController : LeavesViewController { - -} +@interface ProceduralExampleViewController : LeavesViewController @end diff --git a/Classes/ProceduralExampleViewController.m b/Classes/ProceduralExampleViewController.m index 193e02b..5cec6e2 100644 --- a/Classes/ProceduralExampleViewController.m +++ b/Classes/ProceduralExampleViewController.m @@ -11,13 +11,13 @@ @implementation ProceduralExampleViewController -#pragma mark LeavesViewDataSource methods +#pragma mark LeavesViewDataSource -- (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView { +- (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView { return 10; } -- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { +- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { CGRect bounds = CGContextGetClipBoundingBox(ctx); CGContextSetFillColorWithColor(ctx, [[UIColor colorWithHue:index/10.0 saturation:0.8 diff --git a/Leaves/LeavesCache.h b/Leaves/LeavesCache.h index 322a41e..5704a4a 100644 --- a/Leaves/LeavesCache.h +++ b/Leaves/LeavesCache.h @@ -10,19 +10,15 @@ @protocol LeavesViewDataSource; -@interface LeavesCache : NSObject { - NSMutableDictionary *pageCache; - id dataSource; - CGSize pageSize; -} +@interface LeavesCache : NSObject @property (nonatomic, assign) CGSize pageSize; @property (assign) id dataSource; -- (id) initWithPageSize:(CGSize)aPageSize; -- (CGImageRef) cachedImageForPageIndex:(NSUInteger)pageIndex; -- (void) precacheImageForPageIndex:(NSUInteger)pageIndex; -- (void) minimizeToPageIndex:(NSUInteger)pageIndex; -- (void) flush; +- (id)initWithPageSize:(CGSize)aPageSize; +- (CGImageRef)cachedImageForPageIndex:(NSUInteger)pageIndex; +- (void)precacheImageForPageIndex:(NSUInteger)pageIndex; +- (void)minimizeToPageIndex:(NSUInteger)pageIndex; +- (void)flush; @end diff --git a/Leaves/LeavesCache.m b/Leaves/LeavesCache.m index 56f80b1..f715c6a 100644 --- a/Leaves/LeavesCache.m +++ b/Leaves/LeavesCache.m @@ -9,43 +9,45 @@ #import "LeavesCache.h" #import "LeavesView.h" -@implementation LeavesCache +@interface LeavesCache () + +@property (readonly) NSMutableDictionary *pageCache; -@synthesize dataSource, pageSize; +@end -- (id) initWithPageSize:(CGSize)aPageSize +@implementation LeavesCache + +- (id)initWithPageSize:(CGSize)aPageSize { - if ([super init]) { - pageSize = aPageSize; - pageCache = [[NSMutableDictionary alloc] init]; + if (self = [super init]) { + _pageSize = aPageSize; + _pageCache = [[NSMutableDictionary alloc] init]; } return self; } -- (void) dealloc +- (void)dealloc { - [pageCache release]; + [_pageCache release]; [super dealloc]; } - - -- (CGImageRef) imageForPageIndex:(NSUInteger)pageIndex { - if (CGSizeEqualToSize(pageSize, CGSizeZero)) +- (CGImageRef)imageForPageIndex:(NSUInteger)pageIndex { + if (CGSizeEqualToSize(self.pageSize, CGSizeZero)) return NULL; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, - pageSize.width, - pageSize.height, + self.pageSize.width, + self.pageSize.height, 8, /* bits per component*/ - pageSize.width * 4, /* bytes per row */ + self.pageSize.width * 4, /* bytes per row */ colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); CGColorSpaceRelease(colorSpace); - CGContextClipToRect(context, CGRectMake(0, 0, pageSize.width, pageSize.height)); + CGContextClipToRect(context, CGRectMake(0, 0, self.pageSize.width, self.pageSize.height)); - [dataSource renderPageAtIndex:pageIndex inContext:context]; + [self.dataSource renderPageAtIndex:pageIndex inContext:context]; CGImageRef image = CGBitmapContextCreateImage(context); CGContextRelease(context); @@ -56,54 +58,54 @@ - (CGImageRef) imageForPageIndex:(NSUInteger)pageIndex { return image; } -- (CGImageRef) cachedImageForPageIndex:(NSUInteger)pageIndex { +- (CGImageRef)cachedImageForPageIndex:(NSUInteger)pageIndex { NSNumber *pageIndexNumber = [NSNumber numberWithInt:pageIndex]; UIImage *pageImage; - @synchronized (pageCache) { - pageImage = [pageCache objectForKey:pageIndexNumber]; + @synchronized (self.pageCache) { + pageImage = [self.pageCache objectForKey:pageIndexNumber]; } if (!pageImage) { CGImageRef pageCGImage = [self imageForPageIndex:pageIndex]; if (pageCGImage) { pageImage = [UIImage imageWithCGImage:pageCGImage]; - @synchronized (pageCache) { - [pageCache setObject:pageImage forKey:pageIndexNumber]; + @synchronized (self.pageCache) { + [self.pageCache setObject:pageImage forKey:pageIndexNumber]; } } } return pageImage.CGImage; } -- (void) precacheImageForPageIndexNumber:(NSNumber *)pageIndexNumber { +- (void)precacheImageForPageIndexNumber:(NSNumber *)pageIndexNumber { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self cachedImageForPageIndex:[pageIndexNumber intValue]]; [pool release]; } -- (void) precacheImageForPageIndex:(NSUInteger)pageIndex { +- (void)precacheImageForPageIndex:(NSUInteger)pageIndex { [self performSelectorInBackground:@selector(precacheImageForPageIndexNumber:) withObject:[NSNumber numberWithInt:pageIndex]]; } -- (void) minimizeToPageIndex:(NSUInteger)pageIndex { +- (void)minimizeToPageIndex:(NSUInteger)pageIndex { /* Uncache all pages except previous, current, and next. */ - @synchronized (pageCache) { - for (NSNumber *key in [pageCache allKeys]) + @synchronized (self.pageCache) { + for (NSNumber *key in [self.pageCache allKeys]) if (ABS([key intValue] - (int)pageIndex) > 2) - [pageCache removeObjectForKey:key]; + [self.pageCache removeObjectForKey:key]; } } -- (void) flush { - @synchronized (pageCache) { - [pageCache removeAllObjects]; +- (void)flush { + @synchronized (self.pageCache) { + [self.pageCache removeAllObjects]; } } #pragma mark accessors -- (void) setPageSize:(CGSize)value { - pageSize = value; +- (void)setPageSize:(CGSize)value { + _pageSize = value; [self flush]; } diff --git a/Leaves/LeavesView.h b/Leaves/LeavesView.h index f0acf11..226e6cc 100644 --- a/Leaves/LeavesView.h +++ b/Leaves/LeavesView.h @@ -7,40 +7,11 @@ // #import -#import -#import "LeavesCache.h" @protocol LeavesViewDataSource; @protocol LeavesViewDelegate; -@interface LeavesView : UIView { - CALayer *topPage; - CALayer *topPageOverlay; - CAGradientLayer *topPageShadow; - - CALayer *topPageReverse; - CALayer *topPageReverseImage; - CALayer *topPageReverseOverlay; - CAGradientLayer *topPageReverseShading; - - CALayer *bottomPage; - CAGradientLayer *bottomPageShadow; - - CGFloat leafEdge; - NSUInteger currentPageIndex; - NSUInteger numberOfPages; - id delegate; - - CGSize pageSize; - LeavesCache *pageCache; - CGFloat preferredTargetWidth; - BOOL backgroundRendering; - - CGPoint touchBeganPoint; - BOOL touchIsActive; - CGRect nextPageRect, prevPageRect; - BOOL interactionLocked; -} +@interface LeavesView : UIView @property (assign) id dataSource; @property (assign) id delegate; @@ -59,28 +30,26 @@ @property (assign) BOOL backgroundRendering; // refreshes the contents of all pages via the data source methods, much like -[UITableView reloadData] -- (void) reloadData; +- (void)reloadData; @end - @protocol LeavesViewDataSource -- (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView; -- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx; +- (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView; +- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx; @end - @protocol LeavesViewDelegate @optional // called when the user touches up on the left or right side of the page, or finishes dragging the page -- (void) leavesView:(LeavesView *)leavesView willTurnToPageAtIndex:(NSUInteger)pageIndex; +- (void)leavesView:(LeavesView *)leavesView willTurnToPageAtIndex:(NSUInteger)pageIndex; // called when the page-turn animation (following a touch-up or drag) completes -- (void) leavesView:(LeavesView *)leavesView didTurnToPageAtIndex:(NSUInteger)pageIndex; +- (void)leavesView:(LeavesView *)leavesView didTurnToPageAtIndex:(NSUInteger)pageIndex; @end diff --git a/Leaves/LeavesView.m b/Leaves/LeavesView.m index fa5a400..edd2fdb 100644 --- a/Leaves/LeavesView.m +++ b/Leaves/LeavesView.m @@ -7,10 +7,21 @@ // #import "LeavesView.h" +#import "LeavesCache.h" @interface LeavesView () +@property (readonly) CALayer *topPage, *topPageOverlay, *topPageReverse, +*topPageReverseImage, *topPageReverseOverlay, *bottomPage; +@property (readonly) CAGradientLayer *topPageShadow, *topPageReverseShading, +*bottomPageShadow; +@property (nonatomic, assign) NSUInteger numberOfPages; @property (nonatomic, assign) CGFloat leafEdge; +@property (nonatomic, assign) CGSize pageSize; +@property (nonatomic, assign) CGPoint touchBeganPoint; +@property (nonatomic, assign) CGRect nextPageRect, prevPageRect; +@property (nonatomic, assign) BOOL touchIsActive, interactionLocked; +@property (readonly) LeavesCache *pageCache; @end @@ -18,75 +29,72 @@ @interface LeavesView () @implementation LeavesView -@synthesize delegate; -@synthesize leafEdge, currentPageIndex, backgroundRendering, preferredTargetWidth; - -- (void) setUpLayers { +- (void)setUpLayers { self.clipsToBounds = YES; - topPage = [[CALayer alloc] init]; - topPage.masksToBounds = YES; - topPage.contentsGravity = kCAGravityLeft; - topPage.backgroundColor = [[UIColor whiteColor] CGColor]; + _topPage = [[CALayer alloc] init]; + _topPage.masksToBounds = YES; + _topPage.contentsGravity = kCAGravityLeft; + _topPage.backgroundColor = [[UIColor whiteColor] CGColor]; - topPageOverlay = [[CALayer alloc] init]; - topPageOverlay.backgroundColor = [[[UIColor blackColor] colorWithAlphaComponent:0.2] CGColor]; + _topPageOverlay = [[CALayer alloc] init]; + _topPageOverlay.backgroundColor = [[[UIColor blackColor] colorWithAlphaComponent:0.2] CGColor]; - topPageShadow = [[CAGradientLayer alloc] init]; - topPageShadow.colors = [NSArray arrayWithObjects: + _topPageShadow = [[CAGradientLayer alloc] init]; + _topPageShadow.colors = [NSArray arrayWithObjects: (id)[[[UIColor blackColor] colorWithAlphaComponent:0.6] CGColor], (id)[[UIColor clearColor] CGColor], nil]; - topPageShadow.startPoint = CGPointMake(1,0.5); - topPageShadow.endPoint = CGPointMake(0,0.5); + _topPageShadow.startPoint = CGPointMake(1,0.5); + _topPageShadow.endPoint = CGPointMake(0,0.5); - topPageReverse = [[CALayer alloc] init]; - topPageReverse.backgroundColor = [[UIColor whiteColor] CGColor]; - topPageReverse.masksToBounds = YES; + _topPageReverse = [[CALayer alloc] init]; + _topPageReverse.backgroundColor = [[UIColor whiteColor] CGColor]; + _topPageReverse.masksToBounds = YES; - topPageReverseImage = [[CALayer alloc] init]; - topPageReverseImage.masksToBounds = YES; - topPageReverseImage.contentsGravity = kCAGravityRight; + _topPageReverseImage = [[CALayer alloc] init]; + _topPageReverseImage.masksToBounds = YES; + _topPageReverseImage.contentsGravity = kCAGravityRight; - topPageReverseOverlay = [[CALayer alloc] init]; - topPageReverseOverlay.backgroundColor = [[[UIColor whiteColor] colorWithAlphaComponent:0.8] CGColor]; + _topPageReverseOverlay = [[CALayer alloc] init]; + _topPageReverseOverlay.backgroundColor = [[[UIColor whiteColor] colorWithAlphaComponent:0.8] CGColor]; - topPageReverseShading = [[CAGradientLayer alloc] init]; - topPageReverseShading.colors = [NSArray arrayWithObjects: + _topPageReverseShading = [[CAGradientLayer alloc] init]; + _topPageReverseShading.colors = [NSArray arrayWithObjects: (id)[[[UIColor blackColor] colorWithAlphaComponent:0.6] CGColor], (id)[[UIColor clearColor] CGColor], nil]; - topPageReverseShading.startPoint = CGPointMake(1,0.5); - topPageReverseShading.endPoint = CGPointMake(0,0.5); + _topPageReverseShading.startPoint = CGPointMake(1,0.5); + _topPageReverseShading.endPoint = CGPointMake(0,0.5); - bottomPage = [[CALayer alloc] init]; - bottomPage.backgroundColor = [[UIColor whiteColor] CGColor]; - bottomPage.masksToBounds = YES; + _bottomPage = [[CALayer alloc] init]; + _bottomPage.backgroundColor = [[UIColor whiteColor] CGColor]; + _bottomPage.masksToBounds = YES; - bottomPageShadow = [[CAGradientLayer alloc] init]; - bottomPageShadow.colors = [NSArray arrayWithObjects: + _bottomPageShadow = [[CAGradientLayer alloc] init]; + _bottomPageShadow.colors = [NSArray arrayWithObjects: (id)[[[UIColor blackColor] colorWithAlphaComponent:0.6] CGColor], (id)[[UIColor clearColor] CGColor], nil]; - bottomPageShadow.startPoint = CGPointMake(0,0.5); - bottomPageShadow.endPoint = CGPointMake(1,0.5); + _bottomPageShadow.startPoint = CGPointMake(0,0.5); + _bottomPageShadow.endPoint = CGPointMake(1,0.5); - [topPage addSublayer:topPageShadow]; - [topPage addSublayer:topPageOverlay]; - [topPageReverse addSublayer:topPageReverseImage]; - [topPageReverse addSublayer:topPageReverseOverlay]; - [topPageReverse addSublayer:topPageReverseShading]; - [bottomPage addSublayer:bottomPageShadow]; - [self.layer addSublayer:bottomPage]; - [self.layer addSublayer:topPage]; - [self.layer addSublayer:topPageReverse]; + [_topPage addSublayer:_topPageShadow]; + [_topPage addSublayer:_topPageOverlay]; + [_topPageReverse addSublayer:_topPageReverseImage]; + [_topPageReverse addSublayer:_topPageReverseOverlay]; + [_topPageReverse addSublayer:_topPageReverseShading]; + [_bottomPage addSublayer:_bottomPageShadow]; + [self.layer addSublayer:_bottomPage]; + [self.layer addSublayer:_topPage]; + [self.layer addSublayer:_topPageReverse]; self.leafEdge = 1.0; } -- (void) initialize { - backgroundRendering = NO; - pageCache = [[LeavesCache alloc] initWithPageSize:self.bounds.size]; +- (void)initialize { + _backgroundRendering = NO; + _pageCache = [[LeavesCache alloc] initWithPageSize:self.bounds.size]; } - (id)initWithFrame:(CGRect)frame { @@ -97,135 +105,134 @@ - (id)initWithFrame:(CGRect)frame { return self; } -- (void) awakeFromNib { +- (void)awakeFromNib { [super awakeFromNib]; [self setUpLayers]; [self initialize]; } - (void)dealloc { - [topPage release]; - [topPageShadow release]; - [topPageOverlay release]; - [topPageReverse release]; - [topPageReverseImage release]; - [topPageReverseOverlay release]; - [topPageReverseShading release]; - [bottomPage release]; - [bottomPageShadow release]; - - [pageCache release]; + [_topPage release]; + [_topPageShadow release]; + [_topPageOverlay release]; + [_topPageReverse release]; + [_topPageReverseImage release]; + [_topPageReverseOverlay release]; + [_topPageReverseShading release]; + [_bottomPage release]; + [_bottomPageShadow release]; + [_pageCache release]; [super dealloc]; } -- (void) reloadData { - [pageCache flush]; - numberOfPages = [pageCache.dataSource numberOfPagesInLeavesView:self]; +- (void)reloadData { + [self.pageCache flush]; + self.numberOfPages = [self.pageCache.dataSource numberOfPagesInLeavesView:self]; self.currentPageIndex = 0; } -- (void) getImages { - if (currentPageIndex < numberOfPages) { - if (currentPageIndex > 0 && backgroundRendering) - [pageCache precacheImageForPageIndex:currentPageIndex-1]; - topPage.contents = (id)[pageCache cachedImageForPageIndex:currentPageIndex]; - topPageReverseImage.contents = (id)[pageCache cachedImageForPageIndex:currentPageIndex]; - if (currentPageIndex < numberOfPages - 1) - bottomPage.contents = (id)[pageCache cachedImageForPageIndex:currentPageIndex + 1]; - [pageCache minimizeToPageIndex:currentPageIndex]; +- (void)getImages { + if (self.currentPageIndex < self.numberOfPages) { + if (self.currentPageIndex > 0 && self.backgroundRendering) + [self.pageCache precacheImageForPageIndex:self.currentPageIndex-1]; + self.topPage.contents = (id)[self.pageCache cachedImageForPageIndex:self.currentPageIndex]; + self.topPageReverseImage.contents = (id)[self.pageCache cachedImageForPageIndex:self.currentPageIndex]; + if (self.currentPageIndex < self.numberOfPages - 1) + self.bottomPage.contents = (id)[self.pageCache cachedImageForPageIndex:self.currentPageIndex + 1]; + [self.pageCache minimizeToPageIndex:self.currentPageIndex]; } else { - topPage.contents = nil; - topPageReverseImage.contents = nil; - bottomPage.contents = nil; + self.topPage.contents = nil; + self.topPageReverseImage.contents = nil; + self.bottomPage.contents = nil; } } -- (void) setLayerFrames { - topPage.frame = CGRectMake(self.layer.bounds.origin.x, +- (void)setLayerFrames { + self.topPage.frame = CGRectMake(self.layer.bounds.origin.x, self.layer.bounds.origin.y, - leafEdge * self.bounds.size.width, + self.leafEdge * self.bounds.size.width, self.layer.bounds.size.height); - topPageReverse.frame = CGRectMake(self.layer.bounds.origin.x + (2*leafEdge-1) * self.bounds.size.width, + self.topPageReverse.frame = CGRectMake(self.layer.bounds.origin.x + (2*self.leafEdge-1) * self.bounds.size.width, self.layer.bounds.origin.y, - (1-leafEdge) * self.bounds.size.width, + (1-self.leafEdge) * self.bounds.size.width, self.layer.bounds.size.height); - bottomPage.frame = self.layer.bounds; - topPageShadow.frame = CGRectMake(topPageReverse.frame.origin.x - 40, + self.bottomPage.frame = self.layer.bounds; + self.topPageShadow.frame = CGRectMake(self.topPageReverse.frame.origin.x - 40, 0, 40, - bottomPage.bounds.size.height); - topPageReverseImage.frame = topPageReverse.bounds; - topPageReverseImage.transform = CATransform3DMakeScale(-1, 1, 1); - topPageReverseOverlay.frame = topPageReverse.bounds; - topPageReverseShading.frame = CGRectMake(topPageReverse.bounds.size.width - 50, + self.bottomPage.bounds.size.height); + self.topPageReverseImage.frame = self.topPageReverse.bounds; + self.topPageReverseImage.transform = CATransform3DMakeScale(-1, 1, 1); + self.topPageReverseOverlay.frame = self.topPageReverse.bounds; + self.topPageReverseShading.frame = CGRectMake(self.topPageReverse.bounds.size.width - 50, 0, 50 + 1, - topPageReverse.bounds.size.height); - bottomPageShadow.frame = CGRectMake(leafEdge * self.bounds.size.width, + self.topPageReverse.bounds.size.height); + self.bottomPageShadow.frame = CGRectMake(self.leafEdge * self.bounds.size.width, 0, 40, - bottomPage.bounds.size.height); - topPageOverlay.frame = topPage.bounds; + self.bottomPage.bounds.size.height); + self.topPageOverlay.frame = self.topPage.bounds; } -- (void) willTurnToPageAtIndex:(NSUInteger)index { - if ([delegate respondsToSelector:@selector(leavesView:willTurnToPageAtIndex:)]) - [delegate leavesView:self willTurnToPageAtIndex:index]; +- (void)willTurnToPageAtIndex:(NSUInteger)index { + if ([self.delegate respondsToSelector:@selector(leavesView:willTurnToPageAtIndex:)]) + [self.delegate leavesView:self willTurnToPageAtIndex:index]; } -- (void) didTurnToPageAtIndex:(NSUInteger)index { - if ([delegate respondsToSelector:@selector(leavesView:didTurnToPageAtIndex:)]) - [delegate leavesView:self didTurnToPageAtIndex:index]; +- (void)didTurnToPageAtIndex:(NSUInteger)index { + if ([self.delegate respondsToSelector:@selector(leavesView:didTurnToPageAtIndex:)]) + [self.delegate leavesView:self didTurnToPageAtIndex:index]; } -- (void) didTurnPageBackward { - interactionLocked = NO; - [self didTurnToPageAtIndex:currentPageIndex]; +- (void)didTurnPageBackward { + self.interactionLocked = NO; + [self didTurnToPageAtIndex:self.currentPageIndex]; } -- (void) didTurnPageForward { - interactionLocked = NO; +- (void)didTurnPageForward { + self.interactionLocked = NO; self.currentPageIndex = self.currentPageIndex + 1; - [self didTurnToPageAtIndex:currentPageIndex]; + [self didTurnToPageAtIndex:self.currentPageIndex]; } -- (BOOL) hasPrevPage { +- (BOOL)hasPrevPage { return self.currentPageIndex > 0; } -- (BOOL) hasNextPage { - return self.currentPageIndex < numberOfPages - 1; +- (BOOL)hasNextPage { + return self.currentPageIndex < self.numberOfPages - 1; } -- (BOOL) touchedNextPage { - return CGRectContainsPoint(nextPageRect, touchBeganPoint); +- (BOOL)touchedNextPage { + return CGRectContainsPoint(self.nextPageRect, self.touchBeganPoint); } -- (BOOL) touchedPrevPage { - return CGRectContainsPoint(prevPageRect, touchBeganPoint); +- (BOOL)touchedPrevPage { + return CGRectContainsPoint(self.prevPageRect, self.touchBeganPoint); } -- (CGFloat) dragThreshold { +- (CGFloat)dragThreshold { // Magic empirical number return 10; } -- (CGFloat) targetWidth { +- (CGFloat)targetWidth { // Magic empirical formula - if (preferredTargetWidth > 0 && preferredTargetWidth < self.bounds.size.width / 2) - return preferredTargetWidth; + if (self.preferredTargetWidth > 0 && self.preferredTargetWidth < self.bounds.size.width / 2) + return self.preferredTargetWidth; else return MAX(28, self.bounds.size.width / 5); } -- (void) updateTargetRects { +- (void)updateTargetRects { CGFloat targetWidth = [self targetWidth]; - nextPageRect = CGRectMake(self.bounds.size.width - targetWidth, + self.nextPageRect = CGRectMake(self.bounds.size.width - targetWidth, 0, targetWidth, self.bounds.size.height); - prevPageRect = CGRectMake(0, + self.prevPageRect = CGRectMake(0, 0, targetWidth, self.bounds.size.height); @@ -233,25 +240,25 @@ - (void) updateTargetRects { #pragma mark accessors -- (id) dataSource { - return pageCache.dataSource; +- (id)dataSource { + return self.pageCache.dataSource; } -- (void) setDataSource:(id)value { - pageCache.dataSource = value; +- (void)setDataSource:(id)value { + self.pageCache.dataSource = value; } -- (void) setLeafEdge:(CGFloat)aLeafEdge { - leafEdge = aLeafEdge; - topPageShadow.opacity = MIN(1.0, 4*(1-leafEdge)); - bottomPageShadow.opacity = MIN(1.0, 4*leafEdge); - topPageOverlay.opacity = MIN(1.0, 4*(1-leafEdge)); +- (void)setLeafEdge:(CGFloat)aLeafEdge { + _leafEdge = aLeafEdge; + self.topPageShadow.opacity = MIN(1.0, 4*(1-self.leafEdge)); + self.bottomPageShadow.opacity = MIN(1.0, 4*self.leafEdge); + self.topPageOverlay.opacity = MIN(1.0, 4*(1-self.leafEdge)); [self setLayerFrames]; } -- (void) setCurrentPageIndex:(NSUInteger)aCurrentPageIndex { - currentPageIndex = aCurrentPageIndex; +- (void)setCurrentPageIndex:(NSUInteger)aCurrentPageIndex { + _currentPageIndex = aCurrentPageIndex; [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue @@ -264,19 +271,19 @@ - (void) setCurrentPageIndex:(NSUInteger)aCurrentPageIndex { [CATransaction commit]; } -- (void) setPreferredTargetWidth:(CGFloat)value { - preferredTargetWidth = value; +- (void)setPreferredTargetWidth:(CGFloat)value { + _preferredTargetWidth = value; [self updateTargetRects]; } -#pragma mark UIResponder methods +#pragma mark UIResponder - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - if (interactionLocked) + if (self.interactionLocked) return; UITouch *touch = [event.allTouches anyObject]; - touchBeganPoint = [touch locationInView:self]; + self.touchBeganPoint = [touch locationInView:self]; if ([self touchedPrevPage] && [self hasPrevPage]) { [CATransaction begin]; @@ -285,17 +292,17 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { self.currentPageIndex = self.currentPageIndex - 1; self.leafEdge = 0.0; [CATransaction commit]; - touchIsActive = YES; + self.touchIsActive = YES; } else if ([self touchedNextPage] && [self hasNextPage]) - touchIsActive = YES; + self.touchIsActive = YES; else - touchIsActive = NO; + self.touchIsActive = NO; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - if (!touchIsActive) + if (!self.touchIsActive) return; UITouch *touch = [event.allTouches anyObject]; CGPoint touchPoint = [touch locationInView:self]; @@ -309,32 +316,32 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - if (!touchIsActive) + if (!self.touchIsActive) return; - touchIsActive = NO; + self.touchIsActive = NO; UITouch *touch = [event.allTouches anyObject]; CGPoint touchPoint = [touch locationInView:self]; - BOOL dragged = distance(touchPoint, touchBeganPoint) > [self dragThreshold]; + BOOL dragged = distance(touchPoint, self.touchBeganPoint) > [self dragThreshold]; [CATransaction begin]; float duration; if ((dragged && self.leafEdge < 0.5) || (!dragged && [self touchedNextPage])) { - [self willTurnToPageAtIndex:currentPageIndex+1]; + [self willTurnToPageAtIndex:self.currentPageIndex+1]; self.leafEdge = 0; - duration = leafEdge; - interactionLocked = YES; - if (currentPageIndex+2 < numberOfPages && backgroundRendering) - [pageCache precacheImageForPageIndex:currentPageIndex+2]; + duration = self.leafEdge; + self.interactionLocked = YES; + if (self.currentPageIndex+2 < self.numberOfPages && self.backgroundRendering) + [self.pageCache precacheImageForPageIndex:self.currentPageIndex+2]; [self performSelector:@selector(didTurnPageForward) withObject:nil afterDelay:duration + 0.25]; } else { - [self willTurnToPageAtIndex:currentPageIndex]; + [self willTurnToPageAtIndex:self.currentPageIndex]; self.leafEdge = 1.0; - duration = 1 - leafEdge; - interactionLocked = YES; + duration = 1 - self.leafEdge; + self.interactionLocked = YES; [self performSelector:@selector(didTurnPageBackward) withObject:nil afterDelay:duration + 0.25]; @@ -344,19 +351,19 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [CATransaction commit]; } -- (void) layoutSubviews { +- (void)layoutSubviews { [super layoutSubviews]; - - if (!CGSizeEqualToSize(pageSize, self.bounds.size)) { - pageSize = self.bounds.size; + if (!CGSizeEqualToSize(self.pageSize, self.bounds.size)) { + self.pageSize = self.bounds.size; [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; [self setLayerFrames]; [CATransaction commit]; - pageCache.pageSize = self.bounds.size; + + self.pageCache.pageSize = self.bounds.size; [self getImages]; [self updateTargetRects]; } diff --git a/Leaves/LeavesViewController.m b/Leaves/LeavesViewController.m index 4b4aee7..45d52ba 100644 --- a/Leaves/LeavesViewController.m +++ b/Leaves/LeavesViewController.m @@ -30,17 +30,17 @@ - (void)dealloc { [super dealloc]; } -#pragma mark LeavesViewDataSource methods +#pragma mark LeavesViewDataSource -- (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView { +- (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView { return 0; } -- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { +- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { } -#pragma mark UIViewController methods +#pragma mark UIViewController - (void)viewDidLoad { [super viewDidLoad]; From ed56d717ab3346c6cf6886ee46db43b5f6c5e613 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 14:58:52 -0500 Subject: [PATCH 14/23] 0xabad1dea --- .gitattributes | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index fdbd29f..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -crlf -diff -merge From 6242c73bb3a40740c3faada74213d448108cfb10 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 15:12:20 -0500 Subject: [PATCH 15/23] reorganize files --- Leaves.xcodeproj/project.pbxproj | 191 +++++++++--------- .../Classes}/ExamplesViewController.h | 0 .../Classes}/ExamplesViewController.m | 0 .../Classes}/ImageExampleViewController.h | 0 .../Classes}/ImageExampleViewController.m | 0 .../Classes}/LeavesAppDelegate.h | 0 .../Classes}/LeavesAppDelegate.m | 0 .../Classes}/PDFExampleViewController.h | 0 .../Classes}/PDFExampleViewController.m | 0 .../ProceduralExampleViewController.h | 0 .../ProceduralExampleViewController.m | 0 .../Leaves_Prefix.pch | 0 .../Other}/Utilities.h | 0 .../Other}/Utilities.m | 0 .../Resources/Default-568h@2x.png | Bin .../Resources/LeavesExamples-Info.plist | 0 .../Resources}/MainWindow-iPad.xib | 0 .../Resources}/MainWindow.xib | 0 .../Resources}/kitten.jpg | Bin .../Resources}/kitten2.jpg | Bin .../Resources}/kitten3.jpg | Bin .../Resources}/paper.pdf | Bin main.m => LeavesExamples/main.m | 0 23 files changed, 93 insertions(+), 98 deletions(-) rename {Classes => LeavesExamples/Classes}/ExamplesViewController.h (100%) rename {Classes => LeavesExamples/Classes}/ExamplesViewController.m (100%) rename {Classes => LeavesExamples/Classes}/ImageExampleViewController.h (100%) rename {Classes => LeavesExamples/Classes}/ImageExampleViewController.m (100%) rename {Classes => LeavesExamples/Classes}/LeavesAppDelegate.h (100%) rename {Classes => LeavesExamples/Classes}/LeavesAppDelegate.m (100%) rename {Classes => LeavesExamples/Classes}/PDFExampleViewController.h (100%) rename {Classes => LeavesExamples/Classes}/PDFExampleViewController.m (100%) rename {Classes => LeavesExamples/Classes}/ProceduralExampleViewController.h (100%) rename {Classes => LeavesExamples/Classes}/ProceduralExampleViewController.m (100%) rename Leaves_Prefix.pch => LeavesExamples/Leaves_Prefix.pch (100%) rename {Other Sources => LeavesExamples/Other}/Utilities.h (100%) rename {Other Sources => LeavesExamples/Other}/Utilities.m (100%) rename Default-568h@2x.png => LeavesExamples/Resources/Default-568h@2x.png (100%) rename Leaves-Info.plist => LeavesExamples/Resources/LeavesExamples-Info.plist (100%) rename {Resources-iPad => LeavesExamples/Resources}/MainWindow-iPad.xib (100%) rename {Resources => LeavesExamples/Resources}/MainWindow.xib (100%) rename {Resources => LeavesExamples/Resources}/kitten.jpg (100%) rename {Resources => LeavesExamples/Resources}/kitten2.jpg (100%) rename {Resources => LeavesExamples/Resources}/kitten3.jpg (100%) rename {Resources => LeavesExamples/Resources}/paper.pdf (100%) rename main.m => LeavesExamples/main.m (100%) diff --git a/Leaves.xcodeproj/project.pbxproj b/Leaves.xcodeproj/project.pbxproj index 80c2465..f91713e 100755 --- a/Leaves.xcodeproj/project.pbxproj +++ b/Leaves.xcodeproj/project.pbxproj @@ -7,63 +7,63 @@ objects = { /* Begin PBXBuildFile section */ - 1D3623260D0F684500981E51 /* LeavesAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* LeavesAppDelegate.m */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; D337E308119B61A5003E5728 /* LeavesCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D337E307119B61A5003E5728 /* LeavesCache.m */; }; D33D45A2117BDE0100BA7203 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D33D45A1117BDE0100BA7203 /* QuartzCore.framework */; }; - D33D4A0D117C34F000BA7203 /* ImageExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4A0C117C34F000BA7203 /* ImageExampleViewController.m */; }; - D33D4B51117C473500BA7203 /* PDFExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4B50117C473500BA7203 /* PDFExampleViewController.m */; }; - D33D4B85117C4B8F00BA7203 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = D33D4B84117C4B8F00BA7203 /* MainWindow-iPad.xib */; }; D33D4E5B117D818100BA7203 /* LeavesView.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4E58117D818100BA7203 /* LeavesView.m */; }; D33D4E5C117D818100BA7203 /* LeavesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4E5A117D818100BA7203 /* LeavesViewController.m */; }; - D33D4ECC117D8D4500BA7203 /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4EC3117D8D4500BA7203 /* Utilities.m */; }; - D33D4ECD117D8D4500BA7203 /* kitten.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D33D4EC5117D8D4500BA7203 /* kitten.jpg */; }; - D33D4ECE117D8D4500BA7203 /* kitten2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D33D4EC6117D8D4500BA7203 /* kitten2.jpg */; }; - D33D4ECF117D8D4500BA7203 /* kitten3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D33D4EC7117D8D4500BA7203 /* kitten3.jpg */; }; - D33D4ED1117D8D4500BA7203 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = D33D4EC9117D8D4500BA7203 /* MainWindow.xib */; }; - D33D4ED2117D8D4500BA7203 /* paper.pdf in Resources */ = {isa = PBXBuildFile; fileRef = D33D4ECA117D8D4500BA7203 /* paper.pdf */; }; - D33D4F01117D8EAE00BA7203 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4F00117D8EAE00BA7203 /* main.m */; }; - D33D4F41117E244C00BA7203 /* ExamplesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D4F40117E244C00BA7203 /* ExamplesViewController.m */; }; - D33D5176117E780300BA7203 /* ProceduralExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D33D5175117E780300BA7203 /* ProceduralExampleViewController.m */; }; - EA64660717E7A6490060CB7C /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = EA64660617E7A6490060CB7C /* Default-568h@2x.png */; }; + EA97678A17EB8E3C001A0F1C /* ExamplesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97677317EB8E3C001A0F1C /* ExamplesViewController.m */; }; + EA97678B17EB8E3C001A0F1C /* ImageExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97677517EB8E3C001A0F1C /* ImageExampleViewController.m */; }; + EA97678C17EB8E3C001A0F1C /* LeavesAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97677717EB8E3C001A0F1C /* LeavesAppDelegate.m */; }; + EA97678D17EB8E3C001A0F1C /* PDFExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97677917EB8E3C001A0F1C /* PDFExampleViewController.m */; }; + EA97678E17EB8E3C001A0F1C /* ProceduralExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97677B17EB8E3C001A0F1C /* ProceduralExampleViewController.m */; }; + EA97679117EB8E3C001A0F1C /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = EA97678217EB8E3C001A0F1C /* Default-568h@2x.png */; }; + EA97679217EB8E3C001A0F1C /* kitten.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EA97678317EB8E3C001A0F1C /* kitten.jpg */; }; + EA97679317EB8E3C001A0F1C /* kitten2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EA97678417EB8E3C001A0F1C /* kitten2.jpg */; }; + EA97679417EB8E3C001A0F1C /* kitten3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = EA97678517EB8E3C001A0F1C /* kitten3.jpg */; }; + EA97679617EB8E3C001A0F1C /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = EA97678717EB8E3C001A0F1C /* MainWindow-iPad.xib */; }; + EA97679717EB8E3C001A0F1C /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = EA97678817EB8E3C001A0F1C /* MainWindow.xib */; }; + EA97679817EB8E3C001A0F1C /* paper.pdf in Resources */ = {isa = PBXBuildFile; fileRef = EA97678917EB8E3C001A0F1C /* paper.pdf */; }; + EA97679B17EB8FAB001A0F1C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97679A17EB8FAB001A0F1C /* main.m */; }; + EA97679E17EB8FB2001A0F1C /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = EA97679D17EB8FB2001A0F1C /* Utilities.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* LeavesAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeavesAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* LeavesAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeavesAppDelegate.m; sourceTree = ""; }; 1D6058910D05DD3D006BFB54 /* Leaves.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Leaves.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; D337E306119B61A5003E5728 /* LeavesCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeavesCache.h; sourceTree = ""; }; D337E307119B61A5003E5728 /* LeavesCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeavesCache.m; sourceTree = ""; }; D33D45A1117BDE0100BA7203 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - D33D4A0B117C34F000BA7203 /* ImageExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageExampleViewController.h; sourceTree = ""; }; - D33D4A0C117C34F000BA7203 /* ImageExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageExampleViewController.m; sourceTree = ""; }; - D33D4B4F117C473500BA7203 /* PDFExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFExampleViewController.h; sourceTree = ""; }; - D33D4B50117C473500BA7203 /* PDFExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFExampleViewController.m; sourceTree = ""; }; - D33D4B84117C4B8F00BA7203 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainWindow-iPad.xib"; path = "Resources-iPad/MainWindow-iPad.xib"; sourceTree = ""; }; D33D4E57117D818100BA7203 /* LeavesView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeavesView.h; sourceTree = ""; }; D33D4E58117D818100BA7203 /* LeavesView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeavesView.m; sourceTree = ""; }; D33D4E59117D818100BA7203 /* LeavesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeavesViewController.h; sourceTree = ""; }; D33D4E5A117D818100BA7203 /* LeavesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeavesViewController.m; sourceTree = ""; }; - D33D4EC2117D8D4500BA7203 /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utilities.h; sourceTree = ""; }; - D33D4EC3117D8D4500BA7203 /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utilities.m; sourceTree = ""; }; - D33D4EC5117D8D4500BA7203 /* kitten.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = kitten.jpg; sourceTree = ""; }; - D33D4EC6117D8D4500BA7203 /* kitten2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = kitten2.jpg; sourceTree = ""; }; - D33D4EC7117D8D4500BA7203 /* kitten3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = kitten3.jpg; sourceTree = ""; }; - D33D4EC9117D8D4500BA7203 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - D33D4ECA117D8D4500BA7203 /* paper.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = paper.pdf; sourceTree = ""; }; - D33D4EDA117D8DCD00BA7203 /* Leaves-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Leaves-Info.plist"; sourceTree = SOURCE_ROOT; }; - D33D4EFB117D8E7800BA7203 /* Leaves_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Leaves_Prefix.pch; sourceTree = SOURCE_ROOT; }; - D33D4F00117D8EAE00BA7203 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; - D33D4F3F117E244C00BA7203 /* ExamplesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExamplesViewController.h; sourceTree = ""; }; - D33D4F40117E244C00BA7203 /* ExamplesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExamplesViewController.m; sourceTree = ""; }; - D33D5174117E780300BA7203 /* ProceduralExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProceduralExampleViewController.h; sourceTree = ""; }; - D33D5175117E780300BA7203 /* ProceduralExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProceduralExampleViewController.m; sourceTree = ""; }; - EA64660617E7A6490060CB7C /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../Default-568h@2x.png"; sourceTree = ""; }; + EA97677217EB8E3C001A0F1C /* ExamplesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExamplesViewController.h; sourceTree = ""; }; + EA97677317EB8E3C001A0F1C /* ExamplesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExamplesViewController.m; sourceTree = ""; }; + EA97677417EB8E3C001A0F1C /* ImageExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageExampleViewController.h; sourceTree = ""; }; + EA97677517EB8E3C001A0F1C /* ImageExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageExampleViewController.m; sourceTree = ""; }; + EA97677617EB8E3C001A0F1C /* LeavesAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeavesAppDelegate.h; sourceTree = ""; }; + EA97677717EB8E3C001A0F1C /* LeavesAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeavesAppDelegate.m; sourceTree = ""; }; + EA97677817EB8E3C001A0F1C /* PDFExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFExampleViewController.h; sourceTree = ""; }; + EA97677917EB8E3C001A0F1C /* PDFExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFExampleViewController.m; sourceTree = ""; }; + EA97677A17EB8E3C001A0F1C /* ProceduralExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProceduralExampleViewController.h; sourceTree = ""; }; + EA97677B17EB8E3C001A0F1C /* ProceduralExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProceduralExampleViewController.m; sourceTree = ""; }; + EA97678217EB8E3C001A0F1C /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + EA97678317EB8E3C001A0F1C /* kitten.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = kitten.jpg; sourceTree = ""; }; + EA97678417EB8E3C001A0F1C /* kitten2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = kitten2.jpg; sourceTree = ""; }; + EA97678517EB8E3C001A0F1C /* kitten3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = kitten3.jpg; sourceTree = ""; }; + EA97678617EB8E3C001A0F1C /* LeavesExamples-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "LeavesExamples-Info.plist"; sourceTree = ""; }; + EA97678717EB8E3C001A0F1C /* MainWindow-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "MainWindow-iPad.xib"; sourceTree = ""; }; + EA97678817EB8E3C001A0F1C /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; + EA97678917EB8E3C001A0F1C /* paper.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = paper.pdf; sourceTree = ""; }; + EA97679917EB8FAB001A0F1C /* Leaves_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Leaves_Prefix.pch; path = LeavesExamples/Leaves_Prefix.pch; sourceTree = SOURCE_ROOT; }; + EA97679A17EB8FAB001A0F1C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = LeavesExamples/main.m; sourceTree = SOURCE_ROOT; }; + EA97679C17EB8FB2001A0F1C /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utilities.h; path = LeavesExamples/Other/Utilities.h; sourceTree = SOURCE_ROOT; }; + EA97679D17EB8FB2001A0F1C /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Utilities.m; path = LeavesExamples/Other/Utilities.m; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -81,23 +81,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - 1D3623240D0F684500981E51 /* LeavesAppDelegate.h */, - 1D3623250D0F684500981E51 /* LeavesAppDelegate.m */, - D33D4A0B117C34F000BA7203 /* ImageExampleViewController.h */, - D33D4A0C117C34F000BA7203 /* ImageExampleViewController.m */, - D33D4B4F117C473500BA7203 /* PDFExampleViewController.h */, - D33D4B50117C473500BA7203 /* PDFExampleViewController.m */, - D33D4F3F117E244C00BA7203 /* ExamplesViewController.h */, - D33D4F40117E244C00BA7203 /* ExamplesViewController.m */, - D33D5174117E780300BA7203 /* ProceduralExampleViewController.h */, - D33D5175117E780300BA7203 /* ProceduralExampleViewController.m */, - ); - path = Classes; - sourceTree = ""; - }; 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( @@ -110,10 +93,9 @@ isa = PBXGroup; children = ( D33D4E56117D818100BA7203 /* Leaves */, - 080E96DDFE201D6D7F000001 /* Classes */, - D33D4EBF117D8D4500BA7203 /* Other Sources */, - D33D4EC4117D8D4500BA7203 /* Resources */, - D33D4B83117C4B8B00BA7203 /* Resources-iPad */, + EA97677117EB8E3C001A0F1C /* Classes */, + EA97677C17EB8E3C001A0F1C /* Other Sources */, + EA97678117EB8E3C001A0F1C /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); @@ -131,14 +113,6 @@ name = Frameworks; sourceTree = ""; }; - D33D4B83117C4B8B00BA7203 /* Resources-iPad */ = { - isa = PBXGroup; - children = ( - D33D4B84117C4B8F00BA7203 /* MainWindow-iPad.xib */, - ); - name = "Resources-iPad"; - sourceTree = ""; - }; D33D4E56117D818100BA7203 /* Leaves */ = { isa = PBXGroup; children = ( @@ -152,29 +126,50 @@ path = Leaves; sourceTree = ""; }; - D33D4EBF117D8D4500BA7203 /* Other Sources */ = { + EA97677117EB8E3C001A0F1C /* Classes */ = { + isa = PBXGroup; + children = ( + EA97677217EB8E3C001A0F1C /* ExamplesViewController.h */, + EA97677317EB8E3C001A0F1C /* ExamplesViewController.m */, + EA97677417EB8E3C001A0F1C /* ImageExampleViewController.h */, + EA97677517EB8E3C001A0F1C /* ImageExampleViewController.m */, + EA97677617EB8E3C001A0F1C /* LeavesAppDelegate.h */, + EA97677717EB8E3C001A0F1C /* LeavesAppDelegate.m */, + EA97677817EB8E3C001A0F1C /* PDFExampleViewController.h */, + EA97677917EB8E3C001A0F1C /* PDFExampleViewController.m */, + EA97677A17EB8E3C001A0F1C /* ProceduralExampleViewController.h */, + EA97677B17EB8E3C001A0F1C /* ProceduralExampleViewController.m */, + ); + name = Classes; + path = LeavesExamples/Classes; + sourceTree = ""; + }; + EA97677C17EB8E3C001A0F1C /* Other Sources */ = { isa = PBXGroup; children = ( - D33D4F00117D8EAE00BA7203 /* main.m */, - D33D4EFB117D8E7800BA7203 /* Leaves_Prefix.pch */, - D33D4EC2117D8D4500BA7203 /* Utilities.h */, - D33D4EC3117D8D4500BA7203 /* Utilities.m */, + EA97679917EB8FAB001A0F1C /* Leaves_Prefix.pch */, + EA97679A17EB8FAB001A0F1C /* main.m */, + EA97679C17EB8FB2001A0F1C /* Utilities.h */, + EA97679D17EB8FB2001A0F1C /* Utilities.m */, ); - path = "Other Sources"; + name = "Other Sources"; + path = "LeavesExamples/Other Sources"; sourceTree = ""; }; - D33D4EC4117D8D4500BA7203 /* Resources */ = { + EA97678117EB8E3C001A0F1C /* Resources */ = { isa = PBXGroup; children = ( - EA64660617E7A6490060CB7C /* Default-568h@2x.png */, - D33D4EDA117D8DCD00BA7203 /* Leaves-Info.plist */, - D33D4EC9117D8D4500BA7203 /* MainWindow.xib */, - D33D4EC5117D8D4500BA7203 /* kitten.jpg */, - D33D4EC6117D8D4500BA7203 /* kitten2.jpg */, - D33D4EC7117D8D4500BA7203 /* kitten3.jpg */, - D33D4ECA117D8D4500BA7203 /* paper.pdf */, + EA97678217EB8E3C001A0F1C /* Default-568h@2x.png */, + EA97678317EB8E3C001A0F1C /* kitten.jpg */, + EA97678417EB8E3C001A0F1C /* kitten2.jpg */, + EA97678517EB8E3C001A0F1C /* kitten3.jpg */, + EA97678617EB8E3C001A0F1C /* LeavesExamples-Info.plist */, + EA97678717EB8E3C001A0F1C /* MainWindow-iPad.xib */, + EA97678817EB8E3C001A0F1C /* MainWindow.xib */, + EA97678917EB8E3C001A0F1C /* paper.pdf */, ); - path = Resources; + name = Resources; + path = LeavesExamples/Resources; sourceTree = ""; }; /* End PBXGroup section */ @@ -227,13 +222,13 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D33D4B85117C4B8F00BA7203 /* MainWindow-iPad.xib in Resources */, - D33D4ECD117D8D4500BA7203 /* kitten.jpg in Resources */, - D33D4ECE117D8D4500BA7203 /* kitten2.jpg in Resources */, - D33D4ECF117D8D4500BA7203 /* kitten3.jpg in Resources */, - D33D4ED1117D8D4500BA7203 /* MainWindow.xib in Resources */, - EA64660717E7A6490060CB7C /* Default-568h@2x.png in Resources */, - D33D4ED2117D8D4500BA7203 /* paper.pdf in Resources */, + EA97679717EB8E3C001A0F1C /* MainWindow.xib in Resources */, + EA97679817EB8E3C001A0F1C /* paper.pdf in Resources */, + EA97679417EB8E3C001A0F1C /* kitten3.jpg in Resources */, + EA97679217EB8E3C001A0F1C /* kitten.jpg in Resources */, + EA97679117EB8E3C001A0F1C /* Default-568h@2x.png in Resources */, + EA97679617EB8E3C001A0F1C /* MainWindow-iPad.xib in Resources */, + EA97679317EB8E3C001A0F1C /* kitten2.jpg in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -244,15 +239,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1D3623260D0F684500981E51 /* LeavesAppDelegate.m in Sources */, - D33D4A0D117C34F000BA7203 /* ImageExampleViewController.m in Sources */, - D33D4B51117C473500BA7203 /* PDFExampleViewController.m in Sources */, + EA97678E17EB8E3C001A0F1C /* ProceduralExampleViewController.m in Sources */, D33D4E5B117D818100BA7203 /* LeavesView.m in Sources */, + EA97678A17EB8E3C001A0F1C /* ExamplesViewController.m in Sources */, + EA97678D17EB8E3C001A0F1C /* PDFExampleViewController.m in Sources */, + EA97679E17EB8FB2001A0F1C /* Utilities.m in Sources */, + EA97678B17EB8E3C001A0F1C /* ImageExampleViewController.m in Sources */, D33D4E5C117D818100BA7203 /* LeavesViewController.m in Sources */, - D33D4ECC117D8D4500BA7203 /* Utilities.m in Sources */, - D33D4F01117D8EAE00BA7203 /* main.m in Sources */, - D33D4F41117E244C00BA7203 /* ExamplesViewController.m in Sources */, - D33D5176117E780300BA7203 /* ProceduralExampleViewController.m in Sources */, + EA97678C17EB8E3C001A0F1C /* LeavesAppDelegate.m in Sources */, + EA97679B17EB8FAB001A0F1C /* main.m in Sources */, D337E308119B61A5003E5728 /* LeavesCache.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -268,8 +263,7 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Leaves_Prefix.pch; - INFOPLIST_FILE = "Leaves-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/LeavesExamples/Resources/LeavesExamples-Info.plist"; PRODUCT_NAME = Leaves; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -282,8 +276,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Leaves_Prefix.pch; - INFOPLIST_FILE = "Leaves-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/LeavesExamples/Resources/LeavesExamples-Info.plist"; PRODUCT_NAME = Leaves; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -296,6 +289,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; + GCC_PREFIX_HEADER = "$(SRCROOT)/LeavesExamples/Leaves_Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 3.2; @@ -310,6 +304,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; + GCC_PREFIX_HEADER = "$(SRCROOT)/LeavesExamples/Leaves_Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 3.2; diff --git a/Classes/ExamplesViewController.h b/LeavesExamples/Classes/ExamplesViewController.h similarity index 100% rename from Classes/ExamplesViewController.h rename to LeavesExamples/Classes/ExamplesViewController.h diff --git a/Classes/ExamplesViewController.m b/LeavesExamples/Classes/ExamplesViewController.m similarity index 100% rename from Classes/ExamplesViewController.m rename to LeavesExamples/Classes/ExamplesViewController.m diff --git a/Classes/ImageExampleViewController.h b/LeavesExamples/Classes/ImageExampleViewController.h similarity index 100% rename from Classes/ImageExampleViewController.h rename to LeavesExamples/Classes/ImageExampleViewController.h diff --git a/Classes/ImageExampleViewController.m b/LeavesExamples/Classes/ImageExampleViewController.m similarity index 100% rename from Classes/ImageExampleViewController.m rename to LeavesExamples/Classes/ImageExampleViewController.m diff --git a/Classes/LeavesAppDelegate.h b/LeavesExamples/Classes/LeavesAppDelegate.h similarity index 100% rename from Classes/LeavesAppDelegate.h rename to LeavesExamples/Classes/LeavesAppDelegate.h diff --git a/Classes/LeavesAppDelegate.m b/LeavesExamples/Classes/LeavesAppDelegate.m similarity index 100% rename from Classes/LeavesAppDelegate.m rename to LeavesExamples/Classes/LeavesAppDelegate.m diff --git a/Classes/PDFExampleViewController.h b/LeavesExamples/Classes/PDFExampleViewController.h similarity index 100% rename from Classes/PDFExampleViewController.h rename to LeavesExamples/Classes/PDFExampleViewController.h diff --git a/Classes/PDFExampleViewController.m b/LeavesExamples/Classes/PDFExampleViewController.m similarity index 100% rename from Classes/PDFExampleViewController.m rename to LeavesExamples/Classes/PDFExampleViewController.m diff --git a/Classes/ProceduralExampleViewController.h b/LeavesExamples/Classes/ProceduralExampleViewController.h similarity index 100% rename from Classes/ProceduralExampleViewController.h rename to LeavesExamples/Classes/ProceduralExampleViewController.h diff --git a/Classes/ProceduralExampleViewController.m b/LeavesExamples/Classes/ProceduralExampleViewController.m similarity index 100% rename from Classes/ProceduralExampleViewController.m rename to LeavesExamples/Classes/ProceduralExampleViewController.m diff --git a/Leaves_Prefix.pch b/LeavesExamples/Leaves_Prefix.pch similarity index 100% rename from Leaves_Prefix.pch rename to LeavesExamples/Leaves_Prefix.pch diff --git a/Other Sources/Utilities.h b/LeavesExamples/Other/Utilities.h similarity index 100% rename from Other Sources/Utilities.h rename to LeavesExamples/Other/Utilities.h diff --git a/Other Sources/Utilities.m b/LeavesExamples/Other/Utilities.m similarity index 100% rename from Other Sources/Utilities.m rename to LeavesExamples/Other/Utilities.m diff --git a/Default-568h@2x.png b/LeavesExamples/Resources/Default-568h@2x.png similarity index 100% rename from Default-568h@2x.png rename to LeavesExamples/Resources/Default-568h@2x.png diff --git a/Leaves-Info.plist b/LeavesExamples/Resources/LeavesExamples-Info.plist similarity index 100% rename from Leaves-Info.plist rename to LeavesExamples/Resources/LeavesExamples-Info.plist diff --git a/Resources-iPad/MainWindow-iPad.xib b/LeavesExamples/Resources/MainWindow-iPad.xib similarity index 100% rename from Resources-iPad/MainWindow-iPad.xib rename to LeavesExamples/Resources/MainWindow-iPad.xib diff --git a/Resources/MainWindow.xib b/LeavesExamples/Resources/MainWindow.xib similarity index 100% rename from Resources/MainWindow.xib rename to LeavesExamples/Resources/MainWindow.xib diff --git a/Resources/kitten.jpg b/LeavesExamples/Resources/kitten.jpg similarity index 100% rename from Resources/kitten.jpg rename to LeavesExamples/Resources/kitten.jpg diff --git a/Resources/kitten2.jpg b/LeavesExamples/Resources/kitten2.jpg similarity index 100% rename from Resources/kitten2.jpg rename to LeavesExamples/Resources/kitten2.jpg diff --git a/Resources/kitten3.jpg b/LeavesExamples/Resources/kitten3.jpg similarity index 100% rename from Resources/kitten3.jpg rename to LeavesExamples/Resources/kitten3.jpg diff --git a/Resources/paper.pdf b/LeavesExamples/Resources/paper.pdf similarity index 100% rename from Resources/paper.pdf rename to LeavesExamples/Resources/paper.pdf diff --git a/main.m b/LeavesExamples/main.m similarity index 100% rename from main.m rename to LeavesExamples/main.m From aea8ff0aaf4a45afc9b4b5e1080e92aeefb3c3bf Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 15:18:35 -0500 Subject: [PATCH 16/23] rename project to LeavesExamples --- .../project.pbxproj | 32 +++++++++---------- ...s_Prefix.pch => LeavesExamples_Prefix.pch} | 0 2 files changed, 16 insertions(+), 16 deletions(-) rename {Leaves.xcodeproj => LeavesExamples.xcodeproj}/project.pbxproj (93%) rename LeavesExamples/{Leaves_Prefix.pch => LeavesExamples_Prefix.pch} (100%) diff --git a/Leaves.xcodeproj/project.pbxproj b/LeavesExamples.xcodeproj/project.pbxproj similarity index 93% rename from Leaves.xcodeproj/project.pbxproj rename to LeavesExamples.xcodeproj/project.pbxproj index f91713e..c529d76 100755 --- a/Leaves.xcodeproj/project.pbxproj +++ b/LeavesExamples.xcodeproj/project.pbxproj @@ -32,7 +32,7 @@ /* Begin PBXFileReference section */ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D6058910D05DD3D006BFB54 /* Leaves.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Leaves.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1D6058910D05DD3D006BFB54 /* LeavesExamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LeavesExamples.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; D337E306119B61A5003E5728 /* LeavesCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeavesCache.h; sourceTree = ""; }; @@ -60,7 +60,7 @@ EA97678717EB8E3C001A0F1C /* MainWindow-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "MainWindow-iPad.xib"; sourceTree = ""; }; EA97678817EB8E3C001A0F1C /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; EA97678917EB8E3C001A0F1C /* paper.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = paper.pdf; sourceTree = ""; }; - EA97679917EB8FAB001A0F1C /* Leaves_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Leaves_Prefix.pch; path = LeavesExamples/Leaves_Prefix.pch; sourceTree = SOURCE_ROOT; }; + EA97679917EB8FAB001A0F1C /* LeavesExamples_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LeavesExamples_Prefix.pch; path = LeavesExamples/LeavesExamples_Prefix.pch; sourceTree = SOURCE_ROOT; }; EA97679A17EB8FAB001A0F1C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = LeavesExamples/main.m; sourceTree = SOURCE_ROOT; }; EA97679C17EB8FB2001A0F1C /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utilities.h; path = LeavesExamples/Other/Utilities.h; sourceTree = SOURCE_ROOT; }; EA97679D17EB8FB2001A0F1C /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Utilities.m; path = LeavesExamples/Other/Utilities.m; sourceTree = SOURCE_ROOT; }; @@ -84,7 +84,7 @@ 19C28FACFE9D520D11CA2CBB /* Products */ = { isa = PBXGroup; children = ( - 1D6058910D05DD3D006BFB54 /* Leaves.app */, + 1D6058910D05DD3D006BFB54 /* LeavesExamples.app */, ); name = Products; sourceTree = ""; @@ -147,7 +147,7 @@ EA97677C17EB8E3C001A0F1C /* Other Sources */ = { isa = PBXGroup; children = ( - EA97679917EB8FAB001A0F1C /* Leaves_Prefix.pch */, + EA97679917EB8FAB001A0F1C /* LeavesExamples_Prefix.pch */, EA97679A17EB8FAB001A0F1C /* main.m */, EA97679C17EB8FB2001A0F1C /* Utilities.h */, EA97679D17EB8FB2001A0F1C /* Utilities.m */, @@ -175,9 +175,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* Leaves */ = { + 1D6058900D05DD3D006BFB54 /* LeavesExamples */ = { isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Leaves" */; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "LeavesExamples" */; buildPhases = ( 1D60588D0D05DD3D006BFB54 /* Resources */, 1D60588E0D05DD3D006BFB54 /* Sources */, @@ -187,9 +187,9 @@ ); dependencies = ( ); - name = Leaves; + name = LeavesExamples; productName = Leaves; - productReference = 1D6058910D05DD3D006BFB54 /* Leaves.app */; + productReference = 1D6058910D05DD3D006BFB54 /* LeavesExamples.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -201,7 +201,7 @@ LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Tom Brow"; }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Leaves" */; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "LeavesExamples" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; @@ -212,7 +212,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 1D6058900D05DD3D006BFB54 /* Leaves */, + 1D6058900D05DD3D006BFB54 /* LeavesExamples */, ); }; /* End PBXProject section */ @@ -264,7 +264,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; INFOPLIST_FILE = "$(SRCROOT)/LeavesExamples/Resources/LeavesExamples-Info.plist"; - PRODUCT_NAME = Leaves; + PRODUCT_NAME = LeavesExamples; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -277,7 +277,7 @@ COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; INFOPLIST_FILE = "$(SRCROOT)/LeavesExamples/Resources/LeavesExamples-Info.plist"; - PRODUCT_NAME = Leaves; + PRODUCT_NAME = LeavesExamples; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -289,7 +289,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; - GCC_PREFIX_HEADER = "$(SRCROOT)/LeavesExamples/Leaves_Prefix.pch"; + GCC_PREFIX_HEADER = "$(SRCROOT)/LeavesExamples/LeavesExamples_Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 3.2; @@ -304,7 +304,7 @@ buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; - GCC_PREFIX_HEADER = "$(SRCROOT)/LeavesExamples/Leaves_Prefix.pch"; + GCC_PREFIX_HEADER = "$(SRCROOT)/LeavesExamples/LeavesExamples_Prefix.pch"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 3.2; @@ -317,7 +317,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Leaves" */ = { + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "LeavesExamples" */ = { isa = XCConfigurationList; buildConfigurations = ( 1D6058940D05DD3E006BFB54 /* Debug */, @@ -326,7 +326,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Leaves" */ = { + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "LeavesExamples" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, diff --git a/LeavesExamples/Leaves_Prefix.pch b/LeavesExamples/LeavesExamples_Prefix.pch similarity index 100% rename from LeavesExamples/Leaves_Prefix.pch rename to LeavesExamples/LeavesExamples_Prefix.pch From cf5bed9fbed1806eb65ce2e4244b4951685aa59f Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 15:43:33 -0500 Subject: [PATCH 17/23] implement initWithCoder, not awakeFromNib --- Leaves/LeavesView.m | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Leaves/LeavesView.m b/Leaves/LeavesView.m index edd2fdb..5a4aba7 100644 --- a/Leaves/LeavesView.m +++ b/Leaves/LeavesView.m @@ -29,7 +29,7 @@ @interface LeavesView () @implementation LeavesView -- (void)setUpLayers { +- (void)initCommon { self.clipsToBounds = YES; _topPage = [[CALayer alloc] init]; @@ -89,26 +89,23 @@ - (void)setUpLayers { [self.layer addSublayer:_topPage]; [self.layer addSublayer:_topPageReverse]; - self.leafEdge = 1.0; -} - -- (void)initialize { - _backgroundRendering = NO; + _leafEdge = 1.0; + _backgroundRendering = NO; _pageCache = [[LeavesCache alloc] initWithPageSize:self.bounds.size]; } - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { - [self setUpLayers]; - [self initialize]; + [self initCommon]; } return self; } -- (void)awakeFromNib { - [super awakeFromNib]; - [self setUpLayers]; - [self initialize]; +- (id)initWithCoder:(NSCoder *)aDecoder { + if (self = [super initWithCoder:aDecoder]) { + [self initCommon]; + } + return self; } - (void)dealloc { From bdd38561cfa9e8adbcd0d576fcb095dcf67fd153 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 16:13:46 -0500 Subject: [PATCH 18/23] update copyright comments --- Leaves/LeavesCache.h | 4 ++-- Leaves/LeavesCache.m | 4 ++-- LeavesExamples/Classes/ExamplesViewController.h | 2 +- LeavesExamples/Classes/ExamplesViewController.m | 2 +- LeavesExamples/Classes/ImageExampleViewController.h | 2 +- LeavesExamples/Classes/LeavesAppDelegate.h | 2 +- LeavesExamples/Classes/LeavesAppDelegate.m | 2 +- LeavesExamples/Classes/PDFExampleViewController.h | 2 +- LeavesExamples/Classes/PDFExampleViewController.m | 4 ++-- LeavesExamples/Classes/ProceduralExampleViewController.h | 2 +- LeavesExamples/Classes/ProceduralExampleViewController.m | 2 +- LeavesExamples/LeavesExamples_Prefix.pch | 2 +- LeavesExamples/Other/Utilities.h | 2 +- LeavesExamples/Other/Utilities.m | 2 +- LeavesExamples/main.m | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Leaves/LeavesCache.h b/Leaves/LeavesCache.h index 5704a4a..b45f83a 100644 --- a/Leaves/LeavesCache.h +++ b/Leaves/LeavesCache.h @@ -1,9 +1,9 @@ // // LeavesCache.h -// Reader +// Leaves // // Created by Tom Brow on 5/12/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. +// Copyright 2010 Tom Brow. All rights reserved. // #import diff --git a/Leaves/LeavesCache.m b/Leaves/LeavesCache.m index f715c6a..01c4012 100644 --- a/Leaves/LeavesCache.m +++ b/Leaves/LeavesCache.m @@ -1,9 +1,9 @@ // // LeavesCache.m -// Reader +// Leaves // // Created by Tom Brow on 5/12/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. +// Copyright 2010 Tom Brow. All rights reserved. // #import "LeavesCache.h" diff --git a/LeavesExamples/Classes/ExamplesViewController.h b/LeavesExamples/Classes/ExamplesViewController.h index 8fe06c5..ce0cf88 100644 --- a/LeavesExamples/Classes/ExamplesViewController.h +++ b/LeavesExamples/Classes/ExamplesViewController.h @@ -1,6 +1,6 @@ // // ExamplesViewController.h -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/20/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Classes/ExamplesViewController.m b/LeavesExamples/Classes/ExamplesViewController.m index 305288d..8a42bc6 100644 --- a/LeavesExamples/Classes/ExamplesViewController.m +++ b/LeavesExamples/Classes/ExamplesViewController.m @@ -1,6 +1,6 @@ // // ExamplesViewController.m -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/20/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Classes/ImageExampleViewController.h b/LeavesExamples/Classes/ImageExampleViewController.h index f5c677a..2a651f5 100644 --- a/LeavesExamples/Classes/ImageExampleViewController.h +++ b/LeavesExamples/Classes/ImageExampleViewController.h @@ -1,6 +1,6 @@ // // ExampleViewController.h -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/18/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Classes/LeavesAppDelegate.h b/LeavesExamples/Classes/LeavesAppDelegate.h index d0cf5c3..798a65d 100644 --- a/LeavesExamples/Classes/LeavesAppDelegate.h +++ b/LeavesExamples/Classes/LeavesAppDelegate.h @@ -1,6 +1,6 @@ // // LeavesAppDelegate.h -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/18/10. // Copyright Tom Brow 2010. All rights reserved. diff --git a/LeavesExamples/Classes/LeavesAppDelegate.m b/LeavesExamples/Classes/LeavesAppDelegate.m index de84fe5..36ef3db 100644 --- a/LeavesExamples/Classes/LeavesAppDelegate.m +++ b/LeavesExamples/Classes/LeavesAppDelegate.m @@ -1,6 +1,6 @@ // // LeavesAppDelegate.m -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/18/10. // Copyright Tom Brow 2010. All rights reserved. diff --git a/LeavesExamples/Classes/PDFExampleViewController.h b/LeavesExamples/Classes/PDFExampleViewController.h index ff26209..2021cb6 100644 --- a/LeavesExamples/Classes/PDFExampleViewController.h +++ b/LeavesExamples/Classes/PDFExampleViewController.h @@ -1,6 +1,6 @@ // // PDFExampleViewController.h -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/19/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Classes/PDFExampleViewController.m b/LeavesExamples/Classes/PDFExampleViewController.m index a8a97a6..0f45dfb 100644 --- a/LeavesExamples/Classes/PDFExampleViewController.m +++ b/LeavesExamples/Classes/PDFExampleViewController.m @@ -1,6 +1,6 @@ - // +// // PDFExampleViewController.m -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/19/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Classes/ProceduralExampleViewController.h b/LeavesExamples/Classes/ProceduralExampleViewController.h index 3cc70f1..c3af473 100644 --- a/LeavesExamples/Classes/ProceduralExampleViewController.h +++ b/LeavesExamples/Classes/ProceduralExampleViewController.h @@ -1,6 +1,6 @@ // // MinimalExampleViewController.h -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/20/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Classes/ProceduralExampleViewController.m b/LeavesExamples/Classes/ProceduralExampleViewController.m index 5cec6e2..704db64 100644 --- a/LeavesExamples/Classes/ProceduralExampleViewController.m +++ b/LeavesExamples/Classes/ProceduralExampleViewController.m @@ -1,6 +1,6 @@ // // MinimalExampleViewController.m -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/20/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/LeavesExamples_Prefix.pch b/LeavesExamples/LeavesExamples_Prefix.pch index 27dbce8..4da093f 100644 --- a/LeavesExamples/LeavesExamples_Prefix.pch +++ b/LeavesExamples/LeavesExamples_Prefix.pch @@ -1,5 +1,5 @@ // -// Prefix header for all source files of the 'Leaves' target in the 'Leaves' project +// Prefix header for all source files of the 'LeavesExamples' target in the 'LeavesExamples' project // #ifdef __OBJC__ diff --git a/LeavesExamples/Other/Utilities.h b/LeavesExamples/Other/Utilities.h index 1b42b13..1433f28 100644 --- a/LeavesExamples/Other/Utilities.h +++ b/LeavesExamples/Other/Utilities.h @@ -1,6 +1,6 @@ // // Utilities.h -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/19/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/Other/Utilities.m b/LeavesExamples/Other/Utilities.m index c6e60b7..5ef5a94 100644 --- a/LeavesExamples/Other/Utilities.m +++ b/LeavesExamples/Other/Utilities.m @@ -1,6 +1,6 @@ // // Utilities.m -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/19/10. // Copyright 2010 Tom Brow. All rights reserved. diff --git a/LeavesExamples/main.m b/LeavesExamples/main.m index e60ad7e..e11d349 100644 --- a/LeavesExamples/main.m +++ b/LeavesExamples/main.m @@ -1,6 +1,6 @@ // // main.m -// Leaves +// LeavesExamples // // Created by Tom Brow on 4/18/10. // Copyright Tom Brow 2010. All rights reserved. From 402d9aeab74d4b09abaaabc4c204d95d0f1a2b1e Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 17:39:02 -0500 Subject: [PATCH 19/23] document headers --- Leaves/LeavesView.h | 48 +++++++++++++++++++++++++++-------- Leaves/LeavesViewController.h | 6 +++++ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/Leaves/LeavesView.h b/Leaves/LeavesView.h index 226e6cc..442767e 100644 --- a/Leaves/LeavesView.h +++ b/Leaves/LeavesView.h @@ -11,44 +11,72 @@ @protocol LeavesViewDataSource; @protocol LeavesViewDelegate; +// This view displays a sequence of pages, one at a time. The user navigates +// forward and backward through the sequence using a page-turn gesture or by +// tapping invisible targets on the left and right margins of the current page. +// +// Pages are non-interactive raster images supplied by a data source that +// conforms to the LeavesViewDataSource protocol. +// +// An optional delegate, conforming to the LeavesViewDelegate protocol, is +// notified when the page is turned. @interface LeavesView : UIView @property (assign) id dataSource; @property (assign) id delegate; -// the automatically determined width of the interactive areas on either side of the page +// The width of the invisible targets in the left and right margins, which may +// be tapped to turn to the previous and next page respectively. +// +// This value is chosen automatically based on the view's frame unless the +// preferredTargetWidth property is set to a nonzero value. @property (readonly) CGFloat targetWidth; -// set this to a nonzero value to get a targetWidth other than the default +// If this is set to a nonzero value, it will override the value chosen +// automatically for targetWidth. +// +// The default value of this property is 0. @property (nonatomic, assign) CGFloat preferredTargetWidth; -// the zero-based index of the page currently being displayed. +// The zero-based index of the page currently displayed. The value of this +// property changes when the user turns the page. You may also set this value +// programmatically to jump to a certain page. @property (nonatomic, assign) NSUInteger currentPageIndex; -// If backgroundRendering is YES, some pages not currently being displayed will be pre-rendered in background threads. -// The default value is NO. Only set this to YES if your implementation of the data source methods is thread-safe. +// If this property is set to YES, pages likely to be displayed soon will be +// pre-rendered in a background thread to avoid blocking the main thread when +// the page is turned. Only set this to YES if your implementation of the data +// source methods is thread-safe. +// +// The defaut value of this property is NO. @property (assign) BOOL backgroundRendering; -// refreshes the contents of all pages via the data source methods, much like -[UITableView reloadData] +// Reload content from the data source. This also resets the currentPageIndex +// property to 0 and jumps to the first page. - (void)reloadData; @end @protocol LeavesViewDataSource +// Returns the total number of pages to be displayed. - (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView; -- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx; + +// Draws the content of the given page in the given Core Graphics context. Your +// implementation should draw within the bounding box returned by +// CGContextGetClipBoundingBox(context). +- (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)context; @end @protocol LeavesViewDelegate - @optional -// called when the user touches up on the left or right side of the page, or finishes dragging the page +// Called when the user triggers a page turn by touching up in the left or right +// margin, or by completing a page-turn gesture. - (void)leavesView:(LeavesView *)leavesView willTurnToPageAtIndex:(NSUInteger)pageIndex; -// called when the page-turn animation (following a touch-up or drag) completes +// Called when the animation accompanying a page turn completes. - (void)leavesView:(LeavesView *)leavesView didTurnToPageAtIndex:(NSUInteger)pageIndex; @end diff --git a/Leaves/LeavesViewController.h b/Leaves/LeavesViewController.h index 5744489..5af6cad 100644 --- a/Leaves/LeavesViewController.h +++ b/Leaves/LeavesViewController.h @@ -10,8 +10,14 @@ @class LeavesView; +// This view controller presents a LeavesView that occupies its entire view, and +// whose data source and delegate are the view controller itself. +// +// Subclasses should provide content by overriding the view controller's +// implementation of the LeavesViewDataSource protocol. @interface LeavesViewController : UIViewController +// The LeavesView presented by the view controller. @property (readonly) LeavesView *leavesView; @end From d5142f19030441ba48d6763c6d9291e23b0c79b0 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 19:45:27 -0500 Subject: [PATCH 20/23] update README --- README.markdown | 69 +++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/README.markdown b/README.markdown index 72c1a6c..aa6c134 100644 --- a/README.markdown +++ b/README.markdown @@ -1,52 +1,49 @@ #Leaves -Leaves is a simple way to present a page-turning interface similar to Apple's iBooks. It comprises two classes, `LeavesView` and `LeavesViewController`, and occupies less than 100 kB compiled. It uses only public APIs, sacrificing a portion of iBooks' visual flair to ensure that your application is safe for submission to the App Store. +Leaves is an animated interface for navigating through a sequence of images +using page-turning gestures. As of iOS 5, Leaves is mostly obsoleted by +[UIPageViewController]. -Leaves supports: +Leaves requires iOS 3.0 or later. -- Text, images, PDFs -- anything that can be rendered in a graphics context -- Drag or tap to turn the page -- iPad- and iPhone-sized display areas +##Installation -Leaves does *not* currently support: +1. Add the files in the `Leaves` subdirectory to your Xcode project. +2. Ensure that your target links against `QuartzCore.framework`. -- Interactive elements on the page -- Swipe gestures -- Two-page landscape view +##Usage -Leaves requires iPhone OS 3.0 or later. +Creating a page-turning view controller is as simple as subclassing +[LeavesViewController][]: -#Installation + #import "LeavesViewController.h" -Add the files in the `Leaves` subdirectory to your Xcode project and ensure that you are linking against `QuartzCore.framework`. + @interface ColorSwatchViewController : LeavesViewController + @end -#Getting Started +...and implementing the [LeavesViewDataSource][LeavesView] protocol: -Creating a page-turning interface is as simple as subclassing `LeavesViewController`: + @implementation ColorSwatchViewController - @interface ColorSwatchViewController : LeavesViewController - @end + - (NSUInteger)numberOfPagesInLeavesView:(LeavesView*)leavesView { + return 10; + } -...and implementing the `LeavesViewDataSource` protocol: + - (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)context { + CGContextSetFillColorWithColor( + context, + [[UIColor colorWithHue:index/10.0 + saturation:0.8 + brightness:0.8 + alpha:1.0] CGColor]); + CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx)); + } - @implementation ColorSwatchViewController + @end - - (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView { - return 10; - } +You may also use [LeavesView] directly. For more examples, see the included +`LeavesExamples` project. - - (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx { - CGContextSetFillColorWithColor(ctx, [[UIColor colorWithHue:index/10.0 - saturation:0.8 - brightness:0.8 - alpha:1.0] CGColor]); - CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx)); - } - - @end - -For more sophisticated examples, build the Xcode project included with Leaves. - -#Notes - -The best way to get an answer to your question about programming with Leaves is the [Leaves Developers mailing list](http://groups.google.com/group/leaves-developers), which I keep an eye on. But if you find a bug, be sure to visit the [tracker](http://github.com/brow/leaves/issues) or message me directly. \ No newline at end of file +[UIPageViewController]: https://developer.apple.com/library/ios/documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html +[LeavesViewController]: https://github.com/brow/leaves/blob/master/Leaves/LeavesViewController.h +[LeavesView]: https://github.com/brow/leaves/blob/master/Leaves/LeavesView.h From aff06c3ddcc858f6d3187cf250f973c32148b4e3 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 21:53:28 -0500 Subject: [PATCH 21/23] link to notable forks in README --- README.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.markdown b/README.markdown index aa6c134..45a4eb7 100644 --- a/README.markdown +++ b/README.markdown @@ -44,6 +44,11 @@ Creating a page-turning view controller is as simple as subclassing You may also use [LeavesView] directly. For more examples, see the included `LeavesExamples` project. +##Forks +* [Two-page view](https://github.com/ole/leaves/tree/twopages) by [ole](https://github.com/ole) ([blog post](http://oleb.net/blog/2010/06/app-store-safe-page-curl-animations/)) +* [Zooming](https://github.com/hammerlyrodrigo/leaves) by [hammerlyrodrigo](https://github.com/hammerlyrodrigo) +* [ARC](https://github.com/tjboudreaux/leaves) by [tjboudreaux](https://github.com/tjboudreaux) + [UIPageViewController]: https://developer.apple.com/library/ios/documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html [LeavesViewController]: https://github.com/brow/leaves/blob/master/Leaves/LeavesViewController.h [LeavesView]: https://github.com/brow/leaves/blob/master/Leaves/LeavesView.h From 96e8c6ab57ce99f1734357ac8e64ee6af142452d Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Thu, 19 Sep 2013 22:13:43 -0500 Subject: [PATCH 22/23] link to articles in README --- README.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.markdown b/README.markdown index 45a4eb7..d3ae9b3 100644 --- a/README.markdown +++ b/README.markdown @@ -49,6 +49,11 @@ You may also use [LeavesView] directly. For more examples, see the included * [Zooming](https://github.com/hammerlyrodrigo/leaves) by [hammerlyrodrigo](https://github.com/hammerlyrodrigo) * [ARC](https://github.com/tjboudreaux/leaves) by [tjboudreaux](https://github.com/tjboudreaux) +## Articles +* [App Store-safe Page Curl animations](http://oleb.net/blog/2010/06/app-store-safe-page-curl-animations/) +* [How To Add A Slick iBooks Like Page Turning Effect Into Your Apps](http://maniacdev.com/2010/06/lick-ibooks-like-page-turning-effect) +* [Building an iPad Reader for _War of the Worlds_](http://mobile.tutsplus.com/tutorials/iphone/building-an-ipad-reader-for-war-of-the-worlds/) + [UIPageViewController]: https://developer.apple.com/library/ios/documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html [LeavesViewController]: https://github.com/brow/leaves/blob/master/Leaves/LeavesViewController.h [LeavesView]: https://github.com/brow/leaves/blob/master/Leaves/LeavesView.h From 7f2fd7b5796efc5e46d3ac7a6e28edeea0440dc7 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Fri, 20 Sep 2013 17:07:09 -0500 Subject: [PATCH 23/23] link to Retina fork --- README.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/README.markdown b/README.markdown index d3ae9b3..79864ef 100644 --- a/README.markdown +++ b/README.markdown @@ -48,6 +48,7 @@ You may also use [LeavesView] directly. For more examples, see the included * [Two-page view](https://github.com/ole/leaves/tree/twopages) by [ole](https://github.com/ole) ([blog post](http://oleb.net/blog/2010/06/app-store-safe-page-curl-animations/)) * [Zooming](https://github.com/hammerlyrodrigo/leaves) by [hammerlyrodrigo](https://github.com/hammerlyrodrigo) * [ARC](https://github.com/tjboudreaux/leaves) by [tjboudreaux](https://github.com/tjboudreaux) +* [Retina support](https://github.com/Vortec4800/leaves) by [Vortec4800](https://github.com/Vortec4800) ## Articles * [App Store-safe Page Curl animations](http://oleb.net/blog/2010/06/app-store-safe-page-curl-animations/)