Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 90ae776e48c1c7042d3deb31f8df08e2d0adefd4 @neror committed Dec 5, 2011
Showing with 1,937 additions and 0 deletions.
  1. +760 −0 PhotoDispatch.xcodeproj/project.pbxproj
  2. +7 −0 PhotoDispatch.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  3. +17 −0 PhotoDispatch/AppDelegate.h
  4. +69 −0 PhotoDispatch/AppDelegate.m
  5. +18 −0 PhotoDispatch/DetailViewController.h
  6. +63 −0 PhotoDispatch/DetailViewController.m
  7. +92 −0 PhotoDispatch/FTUtils+UIGestureRecognizer.h
  8. +76 −0 PhotoDispatch/FTUtils+UIGestureRecognizer.m
  9. +115 −0 PhotoDispatch/ImageHelpers.h
  10. BIN PhotoDispatch/Images/Abstract 1.jpg
  11. BIN PhotoDispatch/Images/Abstract 2.jpg
  12. BIN PhotoDispatch/Images/Abstract 3.jpg
  13. BIN PhotoDispatch/Images/Abstract 4.jpg
  14. BIN PhotoDispatch/Images/Abstract 5.jpg
  15. BIN PhotoDispatch/Images/Abstract 6.jpg
  16. BIN PhotoDispatch/Images/Abstract 7.jpg
  17. BIN PhotoDispatch/Images/Abstract 8.jpg
  18. BIN PhotoDispatch/Images/Agave.jpg
  19. BIN PhotoDispatch/Images/Andromeda Galaxy.jpg
  20. BIN PhotoDispatch/Images/Aqua Blue.jpg
  21. BIN PhotoDispatch/Images/Aqua Graphite.jpg
  22. BIN PhotoDispatch/Images/Aurora.jpg
  23. BIN PhotoDispatch/Images/Bamboo Grove.jpg
  24. BIN PhotoDispatch/Images/Beach.jpg
  25. BIN PhotoDispatch/Images/Bristle Grass.jpg
  26. BIN PhotoDispatch/Images/Cirques.jpg
  27. BIN PhotoDispatch/Images/Classic Aqua Blue.jpg
  28. BIN PhotoDispatch/Images/Classic Aqua Graphite.jpg
  29. BIN PhotoDispatch/Images/Clown Fish.jpg
  30. BIN PhotoDispatch/Images/Daisies.jpg
  31. BIN PhotoDispatch/Images/Dancer on the Stage.jpg
  32. BIN PhotoDispatch/Images/Dandelion.jpg
  33. BIN PhotoDispatch/Images/Dew Drop.jpg
  34. BIN PhotoDispatch/Images/Ducks on a Misty Pond.jpg
  35. BIN PhotoDispatch/Images/Eagle & Waterfall.jpg
  36. BIN PhotoDispatch/Images/Earth Horizon.jpg
  37. BIN PhotoDispatch/Images/Earth.jpg
  38. BIN PhotoDispatch/Images/Elephant.jpg
  39. BIN PhotoDispatch/Images/Evening Reflections.jpg
  40. BIN PhotoDispatch/Images/Fall Leaves.jpg
  41. BIN PhotoDispatch/Images/Flamingos.jpg
  42. BIN PhotoDispatch/Images/Floating Leaves.jpg
  43. BIN PhotoDispatch/Images/Flow 1.jpg
  44. BIN PhotoDispatch/Images/Flow 2.jpg
  45. BIN PhotoDispatch/Images/Flow 3.jpg
  46. BIN PhotoDispatch/Images/Flowing Rock.jpg
  47. BIN PhotoDispatch/Images/Forest in Mist.jpg
  48. BIN PhotoDispatch/Images/Gentle Rapids.jpg
  49. BIN PhotoDispatch/Images/Golden Palace.jpg
  50. BIN PhotoDispatch/Images/Grass Blades.jpg
  51. BIN PhotoDispatch/Images/Horizon.jpg
  52. BIN PhotoDispatch/Images/Iceberg.jpg
  53. BIN PhotoDispatch/Images/Isles.jpg
  54. BIN PhotoDispatch/Images/Jaguar Aqua Blue.jpg
  55. BIN PhotoDispatch/Images/Jaguar Aqua Graphite.jpg
  56. BIN PhotoDispatch/Images/Ladybug.jpg
  57. BIN PhotoDispatch/Images/Lake.jpg
  58. BIN PhotoDispatch/Images/Lavender.jpg
  59. BIN PhotoDispatch/Images/Leaf Curl.jpg
  60. BIN PhotoDispatch/Images/Leaves.jpg
  61. BIN PhotoDispatch/Images/Leopard Aurora.jpg
  62. BIN PhotoDispatch/Images/Lightning.jpg
  63. BIN PhotoDispatch/Images/Lines Blue.jpg
  64. BIN PhotoDispatch/Images/Lines Graphite.jpg
  65. BIN PhotoDispatch/Images/Lines Moss.jpg
  66. BIN PhotoDispatch/Images/Lines Plum.jpg
  67. BIN PhotoDispatch/Images/Lion.jpg
  68. BIN PhotoDispatch/Images/Lotus.jpg
  69. BIN PhotoDispatch/Images/Maple.jpg
  70. BIN PhotoDispatch/Images/Mojave.jpg
  71. BIN PhotoDispatch/Images/Moon.jpg
  72. BIN PhotoDispatch/Images/Mt. Fuji.jpg
  73. BIN PhotoDispatch/Images/Nighthawks.jpg
  74. BIN PhotoDispatch/Images/Panther Aqua Blue.jpg
  75. BIN PhotoDispatch/Images/Panther Aqua Graphite.jpg
  76. BIN PhotoDispatch/Images/Peony.jpg
  77. BIN PhotoDispatch/Images/Petals.jpg
  78. BIN PhotoDispatch/Images/Pier.jpg
  79. BIN PhotoDispatch/Images/Pink Forest.jpg
  80. BIN PhotoDispatch/Images/Pink Lotus Flower.jpg
  81. BIN PhotoDispatch/Images/Pinstripe.jpg
  82. BIN PhotoDispatch/Images/Pond Reeds.jpg
  83. BIN PhotoDispatch/Images/Poppies Blooming.jpg
  84. BIN PhotoDispatch/Images/Poppies.jpg
  85. BIN PhotoDispatch/Images/Purple Frond.jpg
  86. BIN PhotoDispatch/Images/Red Bells.jpg
  87. BIN PhotoDispatch/Images/Redwoods.jpg
  88. BIN PhotoDispatch/Images/Rings.jpg
  89. BIN PhotoDispatch/Images/Ripples Blue.jpg
  90. BIN PhotoDispatch/Images/Ripples Moss.jpg
  91. BIN PhotoDispatch/Images/Ripples Purple.jpg
  92. BIN PhotoDispatch/Images/Rock Garden.jpg
  93. BIN PhotoDispatch/Images/Rocks.jpg
  94. BIN PhotoDispatch/Images/Saree.jpg
  95. BIN PhotoDispatch/Images/Sea Mist.jpg
  96. BIN PhotoDispatch/Images/Snow Leopard Prowl.jpg
  97. BIN PhotoDispatch/Images/Snow Leopard.jpg
  98. BIN PhotoDispatch/Images/Snowy Hills.jpg
  99. BIN PhotoDispatch/Images/Stones.jpg
  100. BIN PhotoDispatch/Images/Summer Leaves.jpg
  101. BIN PhotoDispatch/Images/Summit.jpg
  102. BIN PhotoDispatch/Images/Sunday Afternoon.jpg
  103. BIN PhotoDispatch/Images/Suprematism.jpg
  104. BIN PhotoDispatch/Images/Tahoe.jpg
  105. BIN PhotoDispatch/Images/The Great Wave.jpg
  106. BIN PhotoDispatch/Images/Tiles Blue.jpg
  107. BIN PhotoDispatch/Images/Tiles Pine.jpg
  108. BIN PhotoDispatch/Images/Tiles Warm Grey.jpg
  109. BIN PhotoDispatch/Images/Tranquil Surface.jpg
  110. BIN PhotoDispatch/Images/Water Lilies.jpg
  111. BIN PhotoDispatch/Images/Water.jpg
  112. BIN PhotoDispatch/Images/Wave.jpg
  113. BIN PhotoDispatch/Images/Winter Sunrise.jpg
  114. BIN PhotoDispatch/Images/Zebra.jpg
  115. +18 −0 PhotoDispatch/MasterViewController.h
  116. +133 −0 PhotoDispatch/MasterViewController.m
  117. +42 −0 PhotoDispatch/PhotoDispatch-Info.plist
  118. +17 −0 PhotoDispatch/PhotoDispatch-Prefix.pch
  119. +32 −0 PhotoDispatch/PhotoGridTableCell.h
  120. +158 −0 PhotoDispatch/PhotoGridTableCell.m
  121. BIN PhotoDispatch/ThumbnailLoadingImage.png
  122. +158 −0 PhotoDispatch/en.lproj/DetailViewController.xib
  123. +2 −0 PhotoDispatch/en.lproj/InfoPlist.strings
  124. +142 −0 PhotoDispatch/en.lproj/MasterViewController.xib
  125. +18 −0 PhotoDispatch/main.m

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,17 @@
+//
+// AppDelegate.h
+// PhotoDispatch
+//
+// Copyright (c) 2011 Nathan Eror & Free Time Studios. All rights reserved.
+//
+
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@property (strong, nonatomic) UINavigationController *navigationController;
+
+@end
@@ -0,0 +1,69 @@
+//
+// AppDelegate.m
+// PhotoDispatch
+//
+// Copyright (c) 2011 Nathan Eror & Free Time Studios. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+#import "MasterViewController.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+@synthesize navigationController = _navigationController;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ // Override point for customization after application launch.
+
+ MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
+ self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
+ self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
+ self.window.rootViewController = self.navigationController;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ /*
+ Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+ */
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ /*
+ Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+ */
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ /*
+ Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+ */
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ /*
+ Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+ */
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ /*
+ Called when the application is about to terminate.
+ Save data if appropriate.
+ See also applicationDidEnterBackground:.
+ */
+}
+
+@end
@@ -0,0 +1,18 @@
+//
+// DetailViewController.h
+// PhotoDispatch
+//
+//
+// Copyright (c) 2011 Nathan Eror & Free Time Studios. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface DetailViewController : UIViewController
+
+@property (strong, nonatomic) NSURL *imageUrl;
+@property (unsafe_unretained) BOOL shouldUseGCD;
+
+- (id)initWithImageAtURL:(NSURL *)theImageUrl;
+
+@end
@@ -0,0 +1,63 @@
+//
+// DetailViewController.m
+// PhotoDispatch
+//
+// Copyright (c) 2011 Nathan Eror & Free Time Studios. All rights reserved.
+//
+
+
+#import "DetailViewController.h"
+#import "ImageHelpers.h"
+
+@interface DetailViewController ()
+
+@property (nonatomic, strong) IBOutlet UIImageView *imageView;
+
+@end
+
+@implementation DetailViewController
+
+@synthesize imageUrl = _imageUrl;
+@synthesize imageView = _imageView;
+@synthesize shouldUseGCD = _shouldUseGCD;
+
+- (id)initWithImageAtURL:(NSURL *)theImageUrl {
+ self = [super initWithNibName:@"DetailViewController" bundle:nil];
+ if (self) {
+ self.title = [theImageUrl lastPathComponent];
+ _imageUrl = theImageUrl;
+ _shouldUseGCD = NO;
+ }
+ return self;
+}
+
+#pragma mark - View lifecycle
+
+- (void)viewWillAppear:(BOOL)animated {
+ self.title = [self.imageUrl lastPathComponent];
+ UIImage *image;
+ if(self.shouldUseGCD) {
+ image = [UIImage imageNamed:@"ThumbnailLoadingImage"];
+ self.imageView.contentMode = UIViewContentModeCenter;
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+ CGImageRef convolvedImage = RandomConvolutionCopyOfImageAtURL((__bridge CFURLRef)self.imageUrl);
+ UIImage *uiImage = [UIImage imageWithCGImage:convolvedImage];
+ CGImageRelease(convolvedImage);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ self.imageView.image = uiImage;
+ self.imageView.contentMode = UIViewContentModeScaleAspectFit;
+ });
+ });
+ } else {
+ CGImageRef convolvedImage = RandomConvolutionCopyOfImageAtURL((__bridge CFURLRef)self.imageUrl);
+ image = [UIImage imageWithCGImage:convolvedImage];
+ CGImageRelease(convolvedImage);
+ }
+ self.imageView.image = image;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return UIInterfaceOrientationIsPortrait(interfaceOrientation);
+}
+
+@end
@@ -0,0 +1,92 @@
+/*
+ The MIT License
+
+ Copyright (c) 2011 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#if NS_BLOCKS_AVAILABLE
+
+typedef void (^FTGestureActionBlock)(id recognizer);
+
+/**
+ This category defines methods and properties which allow the use of blocks
+ for working with `UIGestureRecognizer` and its subclasses.
+
+ For more information on working with gestures in iOS, see Apple's
+ [Event Handling Guide for iOS][1].
+
+ [1]:http://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html
+ */
+@interface UIGestureRecognizer(FTBlockAdditions)
+
+#pragma mark - Creating a block based Gesture Recognizer
+
+///---------------------------------------------------------------------------
+/// @name Creating a block based Gesture Recognizer
+///---------------------------------------------------------------------------
+
+/**
+ Creates an autoreleased instance of a `UIGestureRecognizer` subclass with
+ its actionBlock set to `nil`.
+
+ @warning *Important:* Until the actionBlock is set, the returned object will do nothing.
+
+ @return An instance of a `UIGestureRecognizer` subclass.
+ @see actionBlock
+ */
++ (id)recognizer;
+
+/**
+ Creates an autoreleased instance of a `UIGestureRecognizer` subclass which
+ uses _action_ to handle gesture actions.
+
+ @return An instance of a `UIGestureRecognizer` subclass.
+ @param action A block which will handle the gesture actions.
+ @see actionBlock
+ */
++ (id)recognizerWithActionBlock:(FTGestureActionBlock)action;
+
+#pragma mark - Setting and getting the action handler blocks
+
+///---------------------------------------------------------------------------
+/// @name Setting and getting the action handler blocks
+///---------------------------------------------------------------------------
+
+/**
+ A block to be executed when a `UIGestureRecognizer` action is fired.
+
+ The block is passed a single parameter which is the `UIGestureRecognizer`
+ instance for this property.
+ */
+@property (copy) FTGestureActionBlock actionBlock;
+
+/**
+ A property indicating that the block should *not* be called when
+ the recognizer fires.
+
+ Useful if you need to temporarily disable an action but you still
+ want the block to be around later on.
+*/
+@property (nonatomic, assign) BOOL disabled;
+
+@end
+
+#endif
@@ -0,0 +1,76 @@
+/*
+ The MIT License
+
+ Copyright (c) 2011 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#if NS_BLOCKS_AVAILABLE
+
+#import "FTUtils+UIGestureRecognizer.h"
+#import <objc/runtime.h>
+
+@interface UIGestureRecognizer()
+
+- (void)handleAction:(UIGestureRecognizer *)recognizer;
+
+@end
+
+static char * kFTGestureActionKey = "ft_gestureAction";
+static char * kFTGestureDisabledKey = "ft_gestureDisabled";
+
+@implementation UIGestureRecognizer(FTBlockAdditions)
+
++ (id)recognizer {
+ return [self recognizerWithActionBlock:nil];
+}
+
++ (id)recognizerWithActionBlock:(FTGestureActionBlock)action {
+ id me = [[self class] alloc];
+ me = [me initWithTarget:me action:@selector(handleAction:)];
+ [me setActionBlock:action];
+ return me;
+}
+
+- (void)handleAction:(UIGestureRecognizer *)recognizer {
+ if(self.actionBlock && !self.disabled) {
+ self.actionBlock(recognizer);
+ }
+}
+
+- (FTGestureActionBlock)actionBlock {
+ return objc_getAssociatedObject(self, kFTGestureActionKey);
+}
+
+- (void)setActionBlock:(FTGestureActionBlock)actionBlock {
+ objc_setAssociatedObject(self, kFTGestureActionKey, actionBlock, OBJC_ASSOCIATION_COPY);
+}
+
+- (BOOL)disabled {
+ return [objc_getAssociatedObject(self, kFTGestureDisabledKey) boolValue];
+}
+
+- (void)setDisabled:(BOOL)disabled {
+ objc_setAssociatedObject(self, kFTGestureDisabledKey, [NSNumber numberWithBool:disabled], OBJC_ASSOCIATION_RETAIN);
+}
+
+@end
+
+#endif
Oops, something went wrong.

0 comments on commit 90ae776

Please sign in to comment.