├── .gitignore ├── Classes ├── FTAnimation+UIView.m ├── FTAnimationManager.m ├── FTUtils+NSObject.m └── FTUtils+UIGestureRecognizer.m ├── Examples ├── AnimationChaining.h ├── AnimationChaining.m ├── BackInOut.h ├── BackInOut.m ├── Checkers.png ├── ExampleManager.h ├── ExampleManager.m ├── ExamplesAppDelegate.h ├── ExamplesAppDelegate.m ├── Examples_Prefix.pch ├── FTUtilsExample.h ├── FadeBackgroundColorInOut.h ├── FadeBackgroundColorInOut.m ├── FadeInOut.h ├── FadeInOut.m ├── FallInOut.h ├── FallInOut.m ├── FlyOut.h ├── FlyOut.m ├── GestureRecognizerBlocks.h ├── GestureRecognizerBlocks.m ├── PopInOut.h ├── PopInOut.m ├── RootViewController.h ├── RootViewController.m ├── SimpleAnimationExample.h ├── SimpleAnimationExample.m ├── SlideInOut.h ├── SlideInOut.m ├── ViewBackground.png └── main.m ├── FTAnimationExamples-Info.plist ├── FTUtils.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── FTUtils.xcworkspace └── contents.xcworkspacedata ├── FTUtils_Prefix.pch ├── Headers └── FTUtils │ ├── FTAnimation+UIView.h │ ├── FTAnimation.h │ ├── FTAnimationManager.h │ ├── FTUtils+NSObject.h │ ├── FTUtils+UIGestureRecognizer.h │ └── FTUtils.h ├── Info.plist ├── LICENSE ├── Makefile ├── README.mdown ├── Support └── OCMock.framework │ ├── Headers │ ├── OCMock │ ├── Resources │ └── Versions │ ├── A │ ├── Headers │ │ ├── NSNotificationCenter+OCMAdditions.h │ │ ├── OCMArg.h │ │ ├── OCMConstraint.h │ │ ├── OCMock.h │ │ ├── OCMockObject.h │ │ └── OCMockRecorder.h │ ├── OCMock │ └── Resources │ │ ├── Info.plist │ │ └── License.txt │ └── Current ├── Tests └── TestFTAnimationManager.m ├── UnitTests-Info.plist ├── UnitTests ├── UnitTests-Info.plist ├── UnitTests-Prefix.pch └── en.lproj │ └── InfoPlist.strings ├── VERSION └── apidocs └── .templates ├── docset └── Contents │ ├── Resources │ ├── Documents │ │ └── documents-template │ ├── nodes-template.xml │ └── tokens-template.xml │ └── info-template.plist └── html ├── css └── styles.css ├── document-template.html ├── hierarchy-template.html ├── img ├── button_bar_background.png ├── disclosure.png ├── disclosure_open.png └── title_background.png ├── index-template.html └── object-template.html /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.mode1v3 3 | *.pbxuser 4 | *.perspectivev3 5 | /apidocs/html 6 | /apidocs/docset 7 | /apidocs/publish 8 | *.xcworkspace 9 | *xcuserdata 10 | -------------------------------------------------------------------------------- /Classes/FTAnimation+UIView.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FTAnimation+UIView.h" 26 | #import "FTUtils.h" 27 | #import "FTUtils+NSObject.h" 28 | 29 | @implementation UIView (FTAnimationAdditions) 30 | 31 | #pragma mark - Sliding Animations 32 | 33 | - (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate 34 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 35 | CAAnimation *slideInAnim = [[FTAnimationManager sharedManager] slideInAnimationFor:self direction:direction 36 | duration:duration delegate:delegate 37 | startSelector:startSelector stopSelector:stopSelector]; 38 | [self.layer addAnimation:slideInAnim forKey:kFTAnimationSlideIn]; 39 | } 40 | 41 | - (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate { 42 | [self slideInFrom:direction duration:duration delegate:delegate startSelector:nil stopSelector:nil]; 43 | } 44 | 45 | - (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration 46 | delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 47 | CAAnimation *slideOutAnim = [[FTAnimationManager sharedManager] slideOutAnimationFor:self direction:direction 48 | duration:duration delegate:delegate 49 | startSelector:startSelector stopSelector:stopSelector]; 50 | [self.layer addAnimation:slideOutAnim forKey:kFTAnimationSlideOut]; 51 | } 52 | 53 | - (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate { 54 | [self slideOutTo:direction duration:duration delegate:delegate startSelector:nil stopSelector:nil]; 55 | } 56 | 57 | - (void)slideInFrom:(FTAnimationDirection)direction inView:(UIView*)enclosingView duration:(NSTimeInterval)duration delegate:(id)delegate 58 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 59 | CAAnimation *slideInAnim = [[FTAnimationManager sharedManager] slideInAnimationFor:self direction:direction inView:(UIView*)enclosingView 60 | duration:duration delegate:delegate 61 | startSelector:startSelector stopSelector:stopSelector]; 62 | [self.layer addAnimation:slideInAnim forKey:kFTAnimationSlideIn]; 63 | } 64 | 65 | - (void)slideOutTo:(FTAnimationDirection)direction inView:(UIView*)enclosingView duration:(NSTimeInterval)duration 66 | delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 67 | CAAnimation *slideOutAnim = [[FTAnimationManager sharedManager] slideOutAnimationFor:self direction:direction inView:(UIView*)enclosingView 68 | duration:duration delegate:delegate 69 | startSelector:startSelector stopSelector:stopSelector]; 70 | [self.layer addAnimation:slideOutAnim forKey:kFTAnimationSlideOut]; 71 | } 72 | 73 | 74 | #pragma mark - Back In/Out Animations 75 | 76 | - (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 77 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 78 | CAAnimation *backOutAnim = [[FTAnimationManager sharedManager] backOutAnimationFor:self withFade:fade direction:direction 79 | duration:duration delegate:delegate 80 | startSelector:startSelector stopSelector:stopSelector]; 81 | [self.layer addAnimation:backOutAnim forKey:kFTAnimationBackOut]; 82 | } 83 | 84 | - (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate { 85 | [self backOutTo:direction withFade:fade duration:duration delegate:delegate startSelector:nil stopSelector:nil]; 86 | } 87 | 88 | - (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 89 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 90 | CAAnimation *backInAnim = [[FTAnimationManager sharedManager] backInAnimationFor:self withFade:fade direction:direction 91 | duration:duration delegate:delegate 92 | startSelector:startSelector stopSelector:stopSelector]; 93 | [self.layer addAnimation:backInAnim forKey:kFTAnimationBackIn]; 94 | } 95 | 96 | - (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate { 97 | [self backInFrom:direction withFade:fade duration:duration delegate:delegate startSelector:nil stopSelector:nil]; 98 | } 99 | 100 | - (void)backOutTo:(FTAnimationDirection)direction inView:(UIView*)enclosingView withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 101 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 102 | CAAnimation *backOutAnim = [[FTAnimationManager sharedManager] backOutAnimationFor:self withFade:fade direction:direction inView:enclosingView 103 | duration:duration delegate:delegate 104 | startSelector:startSelector stopSelector:stopSelector]; 105 | [self.layer addAnimation:backOutAnim forKey:kFTAnimationBackOut]; 106 | } 107 | 108 | - (void)backInFrom:(FTAnimationDirection)direction inView:(UIView*)enclosingView withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 109 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 110 | CAAnimation *backInAnim = [[FTAnimationManager sharedManager] backInAnimationFor:self withFade:fade direction:direction inView:enclosingView 111 | duration:duration delegate:delegate 112 | startSelector:startSelector stopSelector:stopSelector]; 113 | [self.layer addAnimation:backInAnim forKey:kFTAnimationBackIn]; 114 | } 115 | 116 | #pragma mark - Fade Animations 117 | 118 | - (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 119 | CAAnimation *anim = [[FTAnimationManager sharedManager] fadeAnimationFor:self duration:duration delegate:delegate 120 | startSelector:startSelector stopSelector:stopSelector fadeOut:NO]; 121 | [self.layer addAnimation:anim forKey:kFTAnimationFadeIn]; 122 | } 123 | 124 | - (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate { 125 | [self fadeIn:duration delegate:delegate startSelector:nil stopSelector:nil]; 126 | } 127 | 128 | - (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 129 | CAAnimation *anim = [[FTAnimationManager sharedManager] fadeAnimationFor:self duration:duration delegate:delegate 130 | startSelector:startSelector stopSelector:stopSelector fadeOut:YES]; 131 | [self.layer addAnimation:anim forKey:kFTAnimationFadeOut]; 132 | } 133 | 134 | - (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate { 135 | [self fadeOut:duration delegate:delegate startSelector:nil stopSelector:nil]; 136 | } 137 | 138 | - (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate 139 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 140 | CAAnimation *anim = [[FTAnimationManager sharedManager] fadeBackgroundColorAnimationFor:self duration:duration 141 | delegate:delegate startSelector:startSelector 142 | stopSelector:stopSelector fadeOut:NO]; 143 | [self.layer addAnimation:anim forKey:kFTAnimationFadeBackgroundIn]; 144 | } 145 | 146 | - (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate { 147 | [self fadeBackgroundColorIn:duration delegate:delegate startSelector:nil stopSelector:nil]; 148 | } 149 | 150 | - (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate 151 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 152 | CAAnimation *anim = [[FTAnimationManager sharedManager] fadeBackgroundColorAnimationFor:self duration:duration 153 | delegate:delegate startSelector:startSelector 154 | stopSelector:stopSelector fadeOut:YES]; 155 | [self.layer addAnimation:anim forKey:kFTAnimationFadeBackgroundOut]; 156 | } 157 | 158 | - (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate { 159 | [self fadeBackgroundColorOut:duration delegate:delegate startSelector:nil stopSelector:nil]; 160 | } 161 | 162 | #pragma mark - Popping Animations 163 | 164 | - (void)popIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 165 | CAAnimation *anim = [[FTAnimationManager sharedManager] popInAnimationFor:self duration:duration delegate:delegate 166 | startSelector:startSelector stopSelector:stopSelector]; 167 | [self.layer addAnimation:anim forKey:kFTAnimationPopIn]; 168 | } 169 | 170 | - (void)popIn:(NSTimeInterval)duration delegate:(id)delegate { 171 | [self popIn:duration delegate:delegate startSelector:nil stopSelector:nil]; 172 | } 173 | 174 | - (void)popOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 175 | CAAnimation *anim = [[FTAnimationManager sharedManager] popOutAnimationFor:self duration:duration delegate:delegate 176 | startSelector:startSelector stopSelector:stopSelector]; 177 | [self.layer addAnimation:anim forKey:kFTAnimationPopOut]; 178 | } 179 | 180 | - (void)popOut:(NSTimeInterval)duration delegate:(id)delegate { 181 | [self popOut:duration delegate:delegate startSelector:nil stopSelector:nil]; 182 | } 183 | 184 | #pragma mark - Fall In and Fly Out 185 | 186 | - (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate { 187 | [self fallIn:duration delegate:delegate startSelector:nil stopSelector:nil]; 188 | } 189 | 190 | - (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 191 | CAAnimation *anim = [[FTAnimationManager sharedManager] fallInAnimationFor:self duration:duration delegate:delegate 192 | startSelector:startSelector stopSelector:stopSelector]; 193 | [self.layer addAnimation:anim forKey:kFTAnimationFallIn]; 194 | } 195 | 196 | - (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate { 197 | [self fallOut:duration delegate:delegate startSelector:nil stopSelector:nil]; 198 | } 199 | 200 | - (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 201 | CAAnimation *anim = [[FTAnimationManager sharedManager] fallOutAnimationFor:self duration:duration delegate:delegate 202 | startSelector:startSelector stopSelector:stopSelector]; 203 | [self.layer addAnimation:anim forKey:kFTAnimationFallOut]; 204 | } 205 | 206 | - (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate { 207 | [self flyOut:duration delegate:delegate startSelector:nil stopSelector:nil]; 208 | } 209 | 210 | - (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector { 211 | CAAnimation *anim = [[FTAnimationManager sharedManager] flyOutAnimationFor:self duration:duration delegate:delegate 212 | startSelector:startSelector stopSelector:stopSelector]; 213 | [self.layer addAnimation:anim forKey:kFTAnimationFlyOut]; 214 | } 215 | 216 | @end 217 | -------------------------------------------------------------------------------- /Classes/FTUtils+NSObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FTUtils+NSObject.h" 26 | 27 | @implementation NSObject (FTUtilsAdditions) 28 | 29 | - (void)performSelector:(SEL)selector andReturnTo:(void *)returnData withArguments:(void **)arguments { 30 | NSMethodSignature *methodSignature = [self methodSignatureForSelector:selector]; 31 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; 32 | [invocation setSelector:selector]; 33 | 34 | NSUInteger argCount = [methodSignature numberOfArguments]; 35 | 36 | for (int i=2; i < argCount; i++) { 37 | void *arg = arguments[i-2]; 38 | [invocation setArgument:arg atIndex:i]; 39 | } 40 | 41 | [invocation invokeWithTarget:self]; 42 | if(returnData != NULL) { 43 | [invocation getReturnValue:returnData]; 44 | } 45 | } 46 | 47 | - (void)performSelector:(SEL)selector withArguments:(void **)arguments { 48 | [self performSelector:selector andReturnTo:NULL withArguments:arguments]; 49 | } 50 | 51 | - (void)performSelectorIfExists:(SEL)selector andReturnTo:(void *)returnData withArguments:(void **)arguments { 52 | if([self respondsToSelector:selector]) { 53 | [self performSelector:selector andReturnTo:returnData withArguments:arguments]; 54 | } 55 | } 56 | 57 | - (void)performSelectorIfExists:(SEL)selector withArguments:(void **)arguments { 58 | [self performSelectorIfExists:selector andReturnTo:NULL withArguments:arguments]; 59 | } 60 | 61 | @end 62 | 63 | @implementation NSArray (FTUtilsAdditions) 64 | 65 | - (NSArray *)reversedArray { 66 | NSMutableArray *array = [NSMutableArray arrayWithCapacity:[self count]]; 67 | NSEnumerator *enumerator = [self reverseObjectEnumerator]; 68 | for (id element in enumerator) { 69 | [array addObject:element]; 70 | } 71 | return [NSArray arrayWithArray:array]; 72 | } 73 | 74 | @end 75 | 76 | @implementation NSMutableArray (FTUtilsAdditions) 77 | 78 | - (void)reverse { 79 | NSUInteger i = 0; 80 | NSUInteger j = [self count] - 1; 81 | while (i < j) { 82 | [self exchangeObjectAtIndex:i withObjectAtIndex:j]; 83 | i++; 84 | j--; 85 | } 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Classes/FTUtils+UIGestureRecognizer.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2011 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #if NS_BLOCKS_AVAILABLE 26 | 27 | #import "FTUtils+UIGestureRecognizer.h" 28 | #import 29 | 30 | @interface UIGestureRecognizer() 31 | 32 | - (void)handleAction:(UIGestureRecognizer *)recognizer; 33 | 34 | @end 35 | 36 | static char * kFTGestureActionKey = "ft_gestureAction"; 37 | static char * kFTGestureDisabledKey = "ft_gestureDisabled"; 38 | 39 | @implementation UIGestureRecognizer(FTBlockAdditions) 40 | 41 | + (id)recognizer { 42 | return [self recognizerWithActionBlock:nil]; 43 | } 44 | 45 | + (id)recognizerWithActionBlock:(FTGestureActionBlock)action { 46 | id me = [[self class] alloc]; 47 | me = [me initWithTarget:me action:@selector(handleAction:)]; 48 | [me setActionBlock:action]; 49 | return [me autorelease]; 50 | } 51 | 52 | - (void)handleAction:(UIGestureRecognizer *)recognizer { 53 | if(self.actionBlock && !self.disabled) { 54 | self.actionBlock(recognizer); 55 | } 56 | } 57 | 58 | - (FTGestureActionBlock)actionBlock { 59 | return objc_getAssociatedObject(self, kFTGestureActionKey); 60 | } 61 | 62 | - (void)setActionBlock:(FTGestureActionBlock)actionBlock { 63 | objc_setAssociatedObject(self, kFTGestureActionKey, actionBlock, OBJC_ASSOCIATION_COPY); 64 | } 65 | 66 | - (BOOL)disabled { 67 | return [objc_getAssociatedObject(self, kFTGestureDisabledKey) boolValue]; 68 | } 69 | 70 | - (void)setDisabled:(BOOL)disabled { 71 | objc_setAssociatedObject(self, kFTGestureDisabledKey, [NSNumber numberWithBool:disabled], OBJC_ASSOCIATION_RETAIN); 72 | } 73 | 74 | @end 75 | 76 | #endif -------------------------------------------------------------------------------- /Examples/AnimationChaining.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "ExampleManager.h" 26 | 27 | @interface AnimationChaining : UIViewController { 28 | UIView *redView_; 29 | UIView *greenView_; 30 | UIView *blueView_; 31 | 32 | UIButton *performAnimationButton_; 33 | } 34 | 35 | @property(nonatomic, retain) UIView *redView; 36 | @property(nonatomic, retain) UIView *blueView; 37 | @property(nonatomic, retain) UIView *greenView; 38 | 39 | @property(nonatomic,retain) UIButton *performAnimationButton; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Examples/AnimationChaining.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "AnimationChaining.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation AnimationChaining 29 | 30 | @synthesize redView = redView_; 31 | @synthesize greenView = greenView_; 32 | @synthesize blueView = blueView_; 33 | 34 | @synthesize performAnimationButton = performAnimationButton_; 35 | 36 | + (NSString *)displayName { 37 | return @"Animation Chaining"; 38 | } 39 | 40 | #pragma mark init and dealloc 41 | 42 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 43 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 44 | self.title = [[self class] displayName]; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)dealloc { 50 | self.redView = nil; 51 | self.greenView = nil; 52 | self.blueView = nil; 53 | self.performAnimationButton = nil; 54 | [super dealloc]; 55 | } 56 | 57 | 58 | #pragma mark Load and unload the view 59 | 60 | - (void)loadView { 61 | self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 62 | self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Checkers.png"]];; 63 | 64 | self.redView = [[[UIView alloc] initWithFrame:CGRectMake(10.f, 20.f, 300.f, 40.f)] autorelease]; 65 | self.redView.backgroundColor = [UIColor redColor]; 66 | self.redView.hidden = YES; 67 | [self.view addSubview:self.redView]; 68 | 69 | self.greenView = [[[UIView alloc] initWithFrame:CGRectMake(10.f, 70.f, 300.f, 40.f)] autorelease]; 70 | self.greenView.backgroundColor = [UIColor greenColor]; 71 | self.greenView.hidden = YES; 72 | [self.view addSubview:self.greenView]; 73 | 74 | self.blueView = [[[UIView alloc] initWithFrame:CGRectMake(10.f, 120.f, 300.f, 40.f)] autorelease]; 75 | self.blueView.backgroundColor = [UIColor blueColor]; 76 | self.blueView.hidden = YES; 77 | [self.view addSubview:self.blueView]; 78 | 79 | self.performAnimationButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 80 | self.performAnimationButton.frame = CGRectMake(10., 356., 300., 44.); 81 | [self.performAnimationButton setTitle:@"Run Animation" forState:UIControlStateNormal]; 82 | [self.performAnimationButton addTarget:self action:@selector(performAnimation:) forControlEvents:UIControlEventTouchUpInside]; 83 | 84 | [self.view addSubview:self.performAnimationButton]; 85 | } 86 | 87 | #pragma mark Animation delegates 88 | 89 | - (void)redAnimationStopped:(CAAnimation *)anim finished:(BOOL)finished { 90 | FTAnimationManager *animManager = [FTAnimationManager sharedManager]; 91 | 92 | CAAnimation *redOut = [animManager backOutAnimationFor:self.redView withFade:NO direction:kFTAnimationTop 93 | duration:1.f delegate:nil startSelector:nil stopSelector:nil]; 94 | 95 | CAAnimation *greenOut = [animManager backOutAnimationFor:self.greenView withFade:NO direction:kFTAnimationTop 96 | duration:.7f delegate:nil startSelector:nil stopSelector:nil]; 97 | greenOut = [animManager delayStartOfAnimation:greenOut withDelay:.3f]; 98 | 99 | CAAnimation *blueOut = [animManager backOutAnimationFor:self.blueView withFade:NO direction:kFTAnimationTop 100 | duration:.4f delegate:nil startSelector:nil stopSelector:nil]; 101 | blueOut = [animManager delayStartOfAnimation:blueOut withDelay:.6f]; 102 | 103 | [CATransaction begin]; 104 | [self.redView.layer addAnimation:redOut forKey:nil]; 105 | [self.greenView.layer addAnimation:greenOut forKey:nil]; 106 | [self.blueView.layer addAnimation:blueOut forKey:nil]; 107 | [CATransaction commit]; 108 | } 109 | 110 | #pragma mark Event Handlers 111 | 112 | - (void)performAnimation:(id)sender { 113 | FTAnimationManager *animManager = [FTAnimationManager sharedManager]; 114 | 115 | CAAnimation *red = [animManager backInAnimationFor:self.redView withFade:NO 116 | direction:kFTAnimationTop duration:.6f 117 | delegate:nil startSelector:nil stopSelector:nil]; 118 | CAAnimation *green = [animManager backInAnimationFor:self.greenView withFade:NO 119 | direction:kFTAnimationTop duration:.6f 120 | delegate:nil startSelector:nil stopSelector:nil]; 121 | CAAnimation *blue = [animManager backInAnimationFor:self.blueView withFade:NO 122 | direction:kFTAnimationTop duration:.6f 123 | delegate:nil startSelector:nil stopSelector:nil]; 124 | 125 | [red setStopSelector:@selector(redAnimationStopped:finished:) withTarget:self]; 126 | 127 | [animManager chainAnimations:[NSArray arrayWithObjects:blue, green, red, nil] run:YES]; 128 | } 129 | 130 | @end 131 | -------------------------------------------------------------------------------- /Examples/BackInOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface BackInOut : SimpleAnimationExample { 29 | 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Examples/BackInOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BackInOut.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation BackInOut 29 | 30 | + (NSString *)displayName { 31 | return @"Back In/Back Out"; 32 | } 33 | 34 | - (void)viewDidLoad { 35 | self.hasDirectionControl = YES; 36 | } 37 | 38 | - (void)performAnimation:(id)sender { 39 | if(self.viewToAnimate.hidden) { 40 | [self.viewToAnimate backInFrom:self.directionControl.selectedSegmentIndex inView:self.viewToAnimate.superview withFade:NO duration:0.4 delegate:nil startSelector:nil stopSelector:nil]; 41 | } else { 42 | [self.viewToAnimate backOutTo:self.directionControl.selectedSegmentIndex inView:self.viewToAnimate.superview withFade:NO duration:0.4 delegate:nil startSelector:nil stopSelector:nil]; 43 | 44 | } 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Examples/Checkers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/Examples/Checkers.png -------------------------------------------------------------------------------- /Examples/ExampleManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface ExampleManager : NSObject { 28 | NSArray *groups_; 29 | NSArray *samples_; 30 | } 31 | 32 | + (NSUInteger)groupCount; 33 | + (NSUInteger)sampleCountForGroup:(NSUInteger)group; 34 | + (NSArray *)samplesForGroup:(NSUInteger)group; 35 | + (NSString *)sampleNameAtIndexPath:(NSIndexPath *)indexPath; 36 | + (UIViewController *)sampleInstanceAtIndexPath:(NSIndexPath *)indexPath; 37 | + (NSString *)groupTitleAtIndex:(NSUInteger)index; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Examples/ExampleManager.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FTUtilsExample.h" 26 | #import "ExampleManager.h" 27 | #import 28 | #import "BackInOut.h" 29 | #import "SlideInOut.h" 30 | #import "FadeInOut.h" 31 | #import "FadeBackgroundColorInOut.h" 32 | #import "PopInOut.h" 33 | #import "FallInOut.h" 34 | #import "FlyOut.h" 35 | #import "AnimationChaining.h" 36 | #import "GestureRecognizerBlocks.h" 37 | 38 | @interface ExampleManager () 39 | 40 | + (ExampleManager *)sharedSampleManager; 41 | 42 | @end 43 | 44 | @implementation ExampleManager 45 | 46 | #pragma mark - 47 | #pragma mark Singleton Management 48 | 49 | static ExampleManager *sharedSampleManager = nil; 50 | 51 | + (ExampleManager *)sharedSampleManager { 52 | @synchronized(self) { 53 | if (sharedSampleManager == nil) { 54 | sharedSampleManager = [[self alloc] init]; 55 | } 56 | } 57 | return sharedSampleManager; 58 | } 59 | 60 | - (id)init { 61 | self = [super init]; 62 | if (self != nil) { 63 | groups_ = [[NSArray alloc] initWithObjects:@"Animating Single Views", 64 | @"Advanced Features", 65 | @"Non-Animation Features", 66 | nil]; 67 | 68 | samples_ = [[NSArray alloc] initWithObjects:[NSArray arrayWithObjects:[BackInOut class], 69 | [SlideInOut class], 70 | [FadeInOut class], 71 | [FadeBackgroundColorInOut class], 72 | [PopInOut class], 73 | [FallInOut class], 74 | [FlyOut class], 75 | nil], 76 | [NSArray arrayWithObject:[AnimationChaining class]], 77 | [NSArray arrayWithObject:[GestureRecognizerBlocks class]], 78 | nil]; 79 | } 80 | return self; 81 | } 82 | 83 | #pragma mark - 84 | #pragma mark Public class methods 85 | 86 | + (NSUInteger)groupCount { 87 | ExampleManager *SELF = [ExampleManager sharedSampleManager]; 88 | return [SELF->groups_ count]; 89 | } 90 | 91 | + (NSUInteger)sampleCountForGroup:(NSUInteger)group { 92 | ExampleManager *SELF = [ExampleManager sharedSampleManager]; 93 | return [[SELF->samples_ objectAtIndex:group] count]; 94 | } 95 | 96 | + (NSArray *)samplesForGroup:(NSUInteger)group { 97 | ExampleManager *SELF = [ExampleManager sharedSampleManager]; 98 | return [[[SELF->samples_ objectAtIndex:group] copy] autorelease]; 99 | } 100 | 101 | + (NSString *)sampleNameAtIndexPath:(NSIndexPath *)indexPath { 102 | ExampleManager *SELF = [ExampleManager sharedSampleManager]; 103 | NSArray *samples = [SELF->samples_ objectAtIndex:indexPath.section]; 104 | Class clazz = [samples objectAtIndex:indexPath.row]; 105 | return [clazz displayName]; 106 | } 107 | 108 | + (UIViewController *)sampleInstanceAtIndexPath:(NSIndexPath *)indexPath { 109 | ExampleManager *SELF = [ExampleManager sharedSampleManager]; 110 | NSArray *samples = [SELF->samples_ objectAtIndex:indexPath.section]; 111 | Class clazz = [samples objectAtIndex:indexPath.row]; 112 | UIViewController *instance = [[clazz alloc] initWithNibName:nil bundle:nil]; 113 | return [instance autorelease]; 114 | } 115 | 116 | + (NSString *)groupTitleAtIndex:(NSUInteger)index { 117 | ExampleManager *SELF = [ExampleManager sharedSampleManager]; 118 | return [[[SELF->groups_ objectAtIndex:index] copy] autorelease]; 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /Examples/ExamplesAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @class RootViewController; 26 | 27 | @interface ExamplesAppDelegate : NSObject { 28 | UIWindow *window_; 29 | UINavigationController *navigationController_; 30 | RootViewController *rootViewController_; 31 | } 32 | 33 | @property(nonatomic,retain) UIWindow *window; 34 | @property(nonatomic,retain) UINavigationController *navigationController; 35 | @property(nonatomic,retain) RootViewController *rootViewController; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Examples/ExamplesAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "ExamplesAppDelegate.h" 26 | #import "RootViewController.h" 27 | 28 | @implementation ExamplesAppDelegate 29 | 30 | @synthesize window = window_; 31 | @synthesize navigationController = navigationController_; 32 | @synthesize rootViewController = rootViewController_; 33 | 34 | 35 | #pragma mark - 36 | #pragma mark Application lifecycle 37 | 38 | - (void)applicationDidFinishLaunching:(UIApplication *)application { 39 | window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 40 | rootViewController_ = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped]; 41 | navigationController_ = [[UINavigationController alloc] initWithRootViewController:rootViewController_]; 42 | 43 | [window_ addSubview:navigationController_.view]; 44 | [window_ makeKeyAndVisible]; 45 | } 46 | 47 | 48 | #pragma mark - 49 | #pragma mark Memory management 50 | 51 | - (void)dealloc { 52 | FTRELEASE(rootViewController_); 53 | FTRELEASE(navigationController_); 54 | FTRELEASE(window_); 55 | [super dealloc]; 56 | } 57 | 58 | @end 59 | 60 | -------------------------------------------------------------------------------- /Examples/Examples_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifdef __OBJC__ 26 | #import 27 | #import 28 | #import "FTUtils.h" 29 | #endif 30 | -------------------------------------------------------------------------------- /Examples/FTUtilsExample.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2011 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @protocol FTUtilsExample 29 | 30 | + (NSString *)displayName; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Examples/FadeBackgroundColorInOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface FadeBackgroundColorInOut : SimpleAnimationExample { 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/FadeBackgroundColorInOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FadeBackgroundColorInOut.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation FadeBackgroundColorInOut 29 | 30 | + (NSString *)displayName { 31 | return @"Fade Background Color In/Out"; 32 | } 33 | 34 | - (void)viewDidLoad { 35 | self.viewToAnimate.image = nil; 36 | self.viewToAnimate.backgroundColor = UIColorFromRGBA(0x0000FF, .85); 37 | self.viewToAnimate.layer.cornerRadius = 20.; 38 | } 39 | 40 | - (void)performAnimation:(id)sender { 41 | if(self.viewToAnimate.hidden) { 42 | [self.viewToAnimate fadeBackgroundColorIn:.4 delegate:nil]; 43 | } else { 44 | [self.viewToAnimate fadeBackgroundColorOut:.4 delegate:nil]; 45 | } 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Examples/FadeInOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface FadeInOut : SimpleAnimationExample { 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/FadeInOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FadeInOut.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation FadeInOut 29 | 30 | + (NSString *)displayName { 31 | return @"Fade In/Fade Out"; 32 | } 33 | 34 | - (void)performAnimation:(id)sender { 35 | if(self.viewToAnimate.hidden) { 36 | [self.viewToAnimate fadeIn:.4 delegate:nil]; 37 | } else { 38 | [self.viewToAnimate fadeOut:.4 delegate:nil]; 39 | } 40 | } 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/FallInOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface FallInOut : SimpleAnimationExample { 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/FallInOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FallInOut.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation FallInOut 29 | 30 | + (NSString *)displayName { 31 | return @"Fall In/Fall Out"; 32 | } 33 | 34 | - (void)performAnimation:(id)sender { 35 | if(self.viewToAnimate.hidden) { 36 | [self.viewToAnimate fallIn:.4 delegate:nil]; 37 | } else { 38 | [self.viewToAnimate fallOut:.4 delegate:nil]; 39 | } 40 | } 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/FlyOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface FlyOut : SimpleAnimationExample { 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/FlyOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FlyOut.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation FlyOut 29 | 30 | + (NSString *)displayName { 31 | return @"Fly Out"; 32 | } 33 | 34 | - (void)performAnimation:(id)sender { 35 | if(self.viewToAnimate.hidden) { 36 | [self.viewToAnimate fadeIn:.2 delegate:nil]; 37 | } else { 38 | [self.viewToAnimate flyOut:.4 delegate:nil]; 39 | } 40 | } 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/GestureRecognizerBlocks.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2011 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | @interface GestureRecognizerBlocks : SimpleAnimationExample { 28 | 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/GestureRecognizerBlocks.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2011 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "GestureRecognizerBlocks.h" 26 | #import "FTUtils+UIGestureRecognizer.h" 27 | 28 | @implementation GestureRecognizerBlocks 29 | 30 | + (NSString *)displayName { 31 | return @"Gesture Recognizer Blocks"; 32 | } 33 | 34 | - (void)viewDidLoad { 35 | [self.performAnimationButton removeFromSuperview]; 36 | self.viewToAnimate.userInteractionEnabled = YES; 37 | self.viewToAnimate.multipleTouchEnabled = YES; 38 | 39 | #if NS_BLOCKS_AVAILABLE 40 | 41 | [self.viewToAnimate addGestureRecognizer: 42 | [UIPanGestureRecognizer recognizerWithActionBlock:^(UIPanGestureRecognizer *pan) { 43 | if(pan.state == UIGestureRecognizerStateBegan || 44 | pan.state == UIGestureRecognizerStateChanged) { 45 | CGPoint translation = [pan translationInView:self.viewToAnimate.superview]; 46 | 47 | self.viewToAnimate.center = CGPointMake(self.viewToAnimate.center.x + translation.x, 48 | self.viewToAnimate.center.y + translation.y); 49 | [pan setTranslation:CGPointZero inView:self.viewToAnimate.superview]; 50 | } 51 | }]]; 52 | 53 | UIPinchGestureRecognizer *thePinch = [UIPinchGestureRecognizer recognizer]; 54 | thePinch.actionBlock = ^(UIPinchGestureRecognizer *pinch) { 55 | if ([pinch state] == UIGestureRecognizerStateBegan || 56 | [pinch state] == UIGestureRecognizerStateChanged) { 57 | self.viewToAnimate.transform = CGAffineTransformScale(self.viewToAnimate.transform, pinch.scale, pinch.scale); 58 | [pinch setScale:1]; 59 | } 60 | }; 61 | [self.viewToAnimate addGestureRecognizer:thePinch]; 62 | 63 | UITapGestureRecognizer *doubleTap = [UITapGestureRecognizer recognizerWithActionBlock:^(id dTap) { 64 | thePinch.disabled = !thePinch.disabled; 65 | [UIView animateWithDuration:.25f animations:^{ 66 | self.viewToAnimate.transform = CGAffineTransformIdentity; 67 | }]; 68 | }]; 69 | doubleTap.numberOfTapsRequired = 2; 70 | [self.viewToAnimate addGestureRecognizer:doubleTap]; 71 | 72 | #endif 73 | } 74 | 75 | - (void)viewDidUnload { 76 | for(UIGestureRecognizer *recognizer in self.viewToAnimate.gestureRecognizers) { 77 | [self.viewToAnimate removeGestureRecognizer:recognizer]; 78 | } 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Examples/PopInOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface PopInOut : SimpleAnimationExample { 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/PopInOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "PopInOut.h" 26 | #import "FTAnimation.h" 27 | 28 | @implementation PopInOut 29 | 30 | + (NSString *)displayName { 31 | return @"Pop In/Pop Out"; 32 | } 33 | 34 | - (void)performAnimation:(id)sender { 35 | if(self.viewToAnimate.hidden) { 36 | [self.viewToAnimate popIn:.4 delegate:nil]; 37 | } else { 38 | [self.viewToAnimate popOut:.4 delegate:nil]; 39 | } 40 | } 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/RootViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface RootViewController : UITableViewController { 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Examples/RootViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "RootViewController.h" 26 | #import "ExampleManager.h" 27 | 28 | @implementation RootViewController 29 | 30 | - (void)viewDidLoad { 31 | self.title = @"Examples"; 32 | } 33 | 34 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 35 | return [ExampleManager groupCount]; 36 | } 37 | 38 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 39 | return [ExampleManager sampleCountForGroup:section]; 40 | } 41 | 42 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 43 | return [ExampleManager groupTitleAtIndex:section]; 44 | } 45 | 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 47 | 48 | NSString *title = [ExampleManager sampleNameAtIndexPath:indexPath]; 49 | 50 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:title]; 51 | if (cell == nil) { 52 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:title] autorelease]; 53 | } 54 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 55 | cell.textLabel.text = title; 56 | return cell; 57 | } 58 | 59 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 60 | UIViewController *controller = [ExampleManager sampleInstanceAtIndexPath:indexPath]; 61 | [self.navigationController pushViewController:controller animated:YES]; 62 | } 63 | 64 | - (void)dealloc { 65 | [super dealloc]; 66 | } 67 | 68 | 69 | @end 70 | 71 | -------------------------------------------------------------------------------- /Examples/SimpleAnimationExample.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import "FTUtilsExample.h" 27 | 28 | @interface SimpleAnimationExample : UIViewController { 29 | UIImageView *viewToAnimate_; 30 | UIButton *performAnimationButton_; 31 | UISegmentedControl *directionControl_; 32 | } 33 | 34 | @property(nonatomic,retain) UIImageView *viewToAnimate; 35 | @property(nonatomic,retain) UIButton *performAnimationButton; 36 | @property(nonatomic,retain) UISegmentedControl *directionControl; 37 | @property(assign) BOOL hasDirectionControl; 38 | 39 | - (void)performAnimation:(id)sender; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Examples/SimpleAnimationExample.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | #import 27 | 28 | @implementation SimpleAnimationExample 29 | 30 | @synthesize viewToAnimate = viewToAnimate_; 31 | @synthesize performAnimationButton = performAnimationButton_; 32 | @synthesize directionControl = directionControl_; 33 | 34 | + (NSString *)displayName { 35 | return @""; 36 | } 37 | 38 | #pragma mark init and dealloc 39 | 40 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 41 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 42 | self.title = [[self class] displayName]; 43 | } 44 | return self; 45 | } 46 | 47 | - (void)dealloc { 48 | self.viewToAnimate = nil; 49 | self.performAnimationButton = nil; 50 | self.directionControl = nil; 51 | [super dealloc]; 52 | } 53 | 54 | - (void)setHasDirectionControl:(BOOL)hasDirection { 55 | if(hasDirection && (self.directionControl.superview == nil)) { 56 | [self.view insertSubview:self.directionControl belowSubview:self.viewToAnimate]; 57 | } else if(!hasDirection && self.directionControl.superview != nil){ 58 | [self.directionControl removeFromSuperview]; 59 | } 60 | } 61 | 62 | - (BOOL)hasDirectionControl { 63 | return (self.directionControl.superview != nil); 64 | } 65 | 66 | #pragma mark Load and unload the view 67 | 68 | - (void)loadView { 69 | self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 70 | self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Checkers.png"]];; 71 | 72 | self.viewToAnimate = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ViewBackground.png"]] autorelease]; 73 | self.viewToAnimate.opaque = NO; 74 | self.viewToAnimate.backgroundColor = [UIColor clearColor]; 75 | self.viewToAnimate.frame = CGRectMake(20., 10., 280., 280.); 76 | 77 | self.performAnimationButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 78 | self.performAnimationButton.frame = CGRectMake(10., 356., 300., 44.); 79 | [self.performAnimationButton setTitle:@"Run Animation" forState:UIControlStateNormal]; 80 | [self.performAnimationButton addTarget:self action:@selector(performAnimation:) forControlEvents:UIControlEventTouchUpInside]; 81 | 82 | NSArray *directionItems = [NSArray arrayWithObjects:@"T", @"R", @"B", @"L", @"TL", @"TR", @"BL", @"BR", nil]; 83 | self.directionControl = [[[UISegmentedControl alloc] initWithItems:directionItems] autorelease]; 84 | self.directionControl.selectedSegmentIndex = 0; 85 | self.directionControl.frame = CGRectMake(10., 300., 300., 44.); 86 | 87 | [self.view addSubview:self.performAnimationButton]; 88 | [self.view addSubview:self.viewToAnimate]; 89 | } 90 | 91 | 92 | #pragma mark Event Handling 93 | 94 | - (void)performAnimation:(id)sender { 95 | NSAssert(NO, @"performAnimation: must be overridden by subclasses"); 96 | } 97 | 98 | @end 99 | 100 | 101 | -------------------------------------------------------------------------------- /Examples/SlideInOut.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SimpleAnimationExample.h" 26 | 27 | 28 | @interface SlideInOut : SimpleAnimationExample { 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/SlideInOut.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SlideInOut.h" 26 | #import "FTAnimation.h" 27 | #import "FTAnimation+UIView.h" 28 | 29 | @implementation SlideInOut 30 | 31 | + (NSString *)displayName { 32 | return @"Slide In/Slide Out"; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | self.hasDirectionControl = YES; 37 | } 38 | 39 | - (void)performAnimation:(id)sender { 40 | if(self.viewToAnimate.hidden) { 41 | [self.viewToAnimate slideInFrom:self.directionControl.selectedSegmentIndex inView:self.viewToAnimate.superview duration:0.4 delegate:nil startSelector:nil stopSelector:nil]; 42 | } else { 43 | [self.viewToAnimate slideOutTo:self.directionControl.selectedSegmentIndex inView:self.viewToAnimate.superview duration:0.4 delegate:nil startSelector:nil stopSelector:nil]; 44 | 45 | } 46 | } 47 | 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Examples/ViewBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/Examples/ViewBackground.png -------------------------------------------------------------------------------- /Examples/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | #import 25 | 26 | int main(int argc, char *argv[]) { 27 | 28 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 29 | int retVal = UIApplicationMain(argc, argv, nil, @"ExamplesAppDelegate"); 30 | [pool release]; 31 | return retVal; 32 | } 33 | -------------------------------------------------------------------------------- /FTAnimationExamples-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.freetimestudios.${PRODUCT_NAME:identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | NSMainNibFile 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /FTUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FTUtils.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FTUtils_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifdef __OBJC__ 26 | #import 27 | #import 28 | #endif 29 | -------------------------------------------------------------------------------- /Headers/FTUtils/FTAnimation+UIView.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FTAnimationManager.h" 26 | 27 | /** 28 | This category provides extra methods on `UIView` which make it very easy to use 29 | the FTAnimationManager pre-built animations. 30 | */ 31 | @interface UIView (FTAnimationAdditions) 32 | 33 | ///--------------------------------------------------------------------------- 34 | /// @name Sliding the view on and off the screen 35 | ///--------------------------------------------------------------------------- 36 | 37 | /** 38 | Slides the view in from the *direction* edge or corner of the screen. 39 | 40 | @param direction The edge or corner of the screen where animation will originate. 41 | @param duration The duration (in seconds) of the animation. 42 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 43 | methods. 44 | */ 45 | - (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate; 46 | 47 | /** 48 | Slides the view in from a specified edge or corner of the screen. 49 | 50 | @param direction The edge or corner of the screen where animation will originate. 51 | @param duration The duration (in seconds) of the animation. 52 | @param delegate An object on which to send the *startSelector* and *stopSelector* 53 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 54 | neither message will be sent. 55 | @param startSelector A selector to be messaged on *delegate* right before the start 56 | of the animation. This parameter can be `nil`. 57 | @param startSelector A selector to be messaged on *delegate* after the animation has 58 | finished normally or been cancelled. This parameter can be `nil`. 59 | */ 60 | - (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate 61 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 62 | 63 | /** 64 | Slides the view out to the *direction* edge or corner of the screen. 65 | 66 | @param direction The edge or corner of the screen where animation will end. 67 | @param duration The duration (in seconds) of the animation. 68 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 69 | methods. 70 | */ 71 | - (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate; 72 | 73 | /** 74 | Slides the view out to a specified edge or corner of the screen. 75 | 76 | @param direction The edge or corner of the screen where animation will end. 77 | @param duration The duration (in seconds) of the animation. 78 | @param delegate An object on which to send the *startSelector* and *stopSelector* 79 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 80 | neither message will be sent. 81 | @param startSelector A selector to be messaged on *delegate* right before the start 82 | of the animation. This parameter can be `nil`. 83 | @param startSelector A selector to be messaged on *delegate* after the animation has 84 | finished normally or been cancelled. This parameter can be `nil`. 85 | */ 86 | - (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate 87 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 88 | 89 | /** Slides the view in from the *direction* edge or corner of the *enclosingView*. */ 90 | - (void)slideInFrom:(FTAnimationDirection)direction inView:(UIView*)enclosingView duration:(NSTimeInterval)duration delegate:(id)delegate 91 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 92 | 93 | /** Slides the view out of the *enclosingView* to the *direction* edge or corner. */ 94 | - (void)slideOutTo:(FTAnimationDirection)direction inView:(UIView*)enclosingView duration:(NSTimeInterval)duration 95 | delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 96 | 97 | /** 98 | Backs the view out to a specified edge or corner of the screen. The view will make a 99 | slight movement in the opposite *direction* before sliding offscreen. 100 | 101 | @param direction The edge or corner of the screen where animation will end. 102 | @param duration The duration (in seconds) of the animation. 103 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 104 | methods. 105 | */ 106 | - (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate; 107 | 108 | /** 109 | Backs the view out to a specified edge or corner of the screen. The view will make a 110 | slight movement in the opposite *direction* before sliding offscreen. 111 | 112 | @param direction The edge or corner of the screen where animation will originate. 113 | @param duration The duration (in seconds) of the animation. 114 | @param delegate An object on which to send the *startSelector* and *stopSelector* 115 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 116 | neither message will be sent. 117 | @param startSelector A selector to be messaged on *delegate* right before the start 118 | of the animation. This parameter can be `nil`. 119 | @param startSelector A selector to be messaged on *delegate* after the animation has 120 | finished normally or been cancelled. This parameter can be `nil`. 121 | */ 122 | - (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 123 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 124 | 125 | /** 126 | Backs the view in from a specified edge or corner of the screen. The view will make a 127 | slight movement in the opposite *direction* before sliding onscreen. 128 | 129 | @param direction The edge or corner of the screen where animation will end. 130 | @param duration The duration (in seconds) of the animation. 131 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 132 | methods. 133 | */ 134 | - (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate; 135 | 136 | /** 137 | Backs the view in from a specified edge or corner of the screen. The view will make a 138 | slight movement in the opposite *direction* before sliding onscreen. 139 | 140 | @param direction The edge or corner of the screen where animation will originate. 141 | @param duration The duration (in seconds) of the animation. 142 | @param delegate An object on which to send the *startSelector* and *stopSelector* 143 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 144 | neither message will be sent. 145 | @param startSelector A selector to be messaged on *delegate* right before the start 146 | of the animation. This parameter can be `nil`. 147 | @param startSelector A selector to be messaged on *delegate* after the animation has 148 | finished normally or been cancelled. This parameter can be `nil`. 149 | */ 150 | - (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 151 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 152 | 153 | /** 154 | Backs the view off of a specified edge or corner of the *enclosingView*. The view will 155 | make a slight movement in the opposite *direction* before sliding off of the *enclosingView*. 156 | */ 157 | - (void)backOutTo:(FTAnimationDirection)direction inView:(UIView*)enclosingView withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 158 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 159 | 160 | /** 161 | Backs the view in from a specified edge or corner of the *enclosingView*. The view will 162 | make a slight movement in the opposite *direction* before sliding over the *enclosingView*. 163 | */ 164 | - (void)backInFrom:(FTAnimationDirection)direction inView:(UIView*)enclosingView withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate 165 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 166 | 167 | ///--------------------------------------------------------------------------- 168 | /// @name Fading the view in and out 169 | ///--------------------------------------------------------------------------- 170 | 171 | /** 172 | Causes the view to fade in from invisible to fully opaque. 173 | 174 | @param direction The edge or corner of the screen where animation will end. 175 | @param duration The duration (in seconds) of the animation. 176 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 177 | methods. 178 | */ 179 | - (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate; 180 | 181 | /** 182 | Causes the view to fade in from invisible to fully opaque. 183 | 184 | @param duration The duration (in seconds) of the animation. 185 | @param delegate An object on which to send the *startSelector* and *stopSelector* 186 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 187 | neither message will be sent. 188 | @param startSelector A selector to be messaged on *delegate* right before the start 189 | of the animation. This parameter can be `nil`. 190 | @param startSelector A selector to be messaged on *delegate* after the animation has 191 | finished normally or been cancelled. This parameter can be `nil`. 192 | */ 193 | - (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 194 | 195 | /** 196 | Causes the view to fade out until it is invisible. 197 | 198 | @param direction The edge or corner of the screen where animation will end. 199 | @param duration The duration (in seconds) of the animation. 200 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 201 | methods. 202 | */ 203 | - (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate; 204 | 205 | /** 206 | Causes the view to fade out until it is invisible. 207 | 208 | @param duration The duration (in seconds) of the animation. 209 | @param delegate An object on which to send the *startSelector* and *stopSelector* 210 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 211 | neither message will be sent. 212 | @param startSelector A selector to be messaged on *delegate* right before the start 213 | of the animation. This parameter can be `nil`. 214 | @param startSelector A selector to be messaged on *delegate* after the animation has 215 | finished normally or been cancelled. This parameter can be `nil`. 216 | */ 217 | - (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 218 | 219 | /** 220 | Causes the background color of the view to fade in from invisible to completely 221 | opaque. 222 | 223 | @param direction The edge or corner of the screen where animation will end. 224 | @param duration The duration (in seconds) of the animation. 225 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 226 | methods. 227 | */ 228 | - (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate; 229 | 230 | /** 231 | Causes the background color of the view to fade in from invisible to completely 232 | opaque. 233 | 234 | @param duration The duration (in seconds) of the animation. 235 | @param delegate An object on which to send the *startSelector* and *stopSelector* 236 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 237 | neither message will be sent. 238 | @param startSelector A selector to be messaged on *delegate* right before the start 239 | of the animation. This parameter can be `nil`. 240 | @param startSelector A selector to be messaged on *delegate* after the animation has 241 | finished normally or been cancelled. This parameter can be `nil`. 242 | */ 243 | - (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate 244 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 245 | 246 | /** 247 | Causes the background color of the view to fade out until it is invisible. 248 | 249 | @param direction The edge or corner of the screen where animation will end. 250 | @param duration The duration (in seconds) of the animation. 251 | @param delegate The *delegate* will be forwarded the standard `CAAnimationDelegate` 252 | methods. 253 | */ 254 | - (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate; 255 | 256 | /** 257 | Causes the background color of the view to fade out until it is invisible. 258 | 259 | @param duration The duration (in seconds) of the animation. 260 | @param delegate An object on which to send the *startSelector* and *stopSelector* 261 | messages. The animation framework _does not_ retain *delegate*. If it is `nil`, 262 | neither message will be sent. 263 | @param startSelector A selector to be messaged on *delegate* right before the start 264 | of the animation. This parameter can be `nil`. 265 | @param startSelector A selector to be messaged on *delegate* after the animation has 266 | finished normally or been cancelled. This parameter can be `nil`. 267 | */ 268 | - (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate 269 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 270 | 271 | 272 | ///--------------------------------------------------------------------------- 273 | /// @name Scaling the view up and down 274 | ///--------------------------------------------------------------------------- 275 | 276 | /** 277 | Pops the view in from the center of the screen similar to the animation of a `UIAlertView`. 278 | The view will start invisible and small in the center of the screen, and it will be animated 279 | to its final size with a rubber band bounce at the end. 280 | */ 281 | - (void)popIn:(NSTimeInterval)duration delegate:(id)delegate; 282 | 283 | /** 284 | Pops the view in from the center of the screen similar to the animation of a `UIAlertView`. 285 | The view will start invisible and small in the center of the screen, and it will be animated 286 | to its final size with a rubber band bounce at the end. 287 | */ 288 | - (void)popIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 289 | 290 | /** 291 | This is the reverse of the *popIn* animation. The view will scale to a slightly larger size 292 | before shrinking to nothing in the middle of the screen. 293 | */ 294 | - (void)popOut:(NSTimeInterval)duration delegate:(id)delegate; 295 | 296 | /** 297 | This is the reverse of the *popIn* animation. The view will scale to a slightly larger size 298 | before shrinking to nothing in the middle of the screen. 299 | */ 300 | - (void)popOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 301 | 302 | /** 303 | The view will fade in and shrink from double its size down to its regular size. This makes 304 | it appear as though the view is falling onto the screen from the user's vantage point. 305 | */ 306 | - (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate; 307 | 308 | /** 309 | The view will fade in and shrink from double its size down to its regular size. This makes 310 | it appear as though the view is falling onto the screen from the user's vantage point. 311 | */ 312 | - (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 313 | /** 314 | The view will shrink to nothing in the middle of the screen and disappear. 315 | */ 316 | - (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate; 317 | 318 | /** 319 | The view will shrink to nothing in the middle of the screen and disappear. 320 | */ 321 | - (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 322 | 323 | /** 324 | The view will scale up to twice its size while fading to invisible. 325 | */ 326 | - (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate; 327 | 328 | /** 329 | The view will scale up to twice its size while fading to invisible. 330 | */ 331 | - (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 332 | 333 | @end 334 | -------------------------------------------------------------------------------- /Headers/FTUtils/FTAnimation.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "FTUtils.h" 26 | #import "FTUtils+NSObject.h" 27 | #import "FTAnimationManager.h" 28 | #import "FTAnimation+UIView.h" -------------------------------------------------------------------------------- /Headers/FTUtils/FTAnimationManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import 27 | #import 28 | 29 | typedef enum _FTAnimationDirection { 30 | kFTAnimationTop = 0, 31 | kFTAnimationRight, 32 | kFTAnimationBottom, 33 | kFTAnimationLeft, 34 | kFTAnimationTopLeft, 35 | kFTAnimationTopRight, 36 | kFTAnimationBottomLeft, 37 | kFTAnimationBottomRight 38 | } FTAnimationDirection; 39 | 40 | #pragma mark String Constants 41 | 42 | extern NSString *const kFTAnimationName; 43 | extern NSString *const kFTAnimationType; 44 | extern NSString *const kFTAnimationTypeIn; 45 | extern NSString *const kFTAnimationTypeOut; 46 | 47 | extern NSString *const kFTAnimationSlideIn; 48 | extern NSString *const kFTAnimationSlideOut; 49 | extern NSString *const kFTAnimationBackOut; 50 | extern NSString *const kFTAnimationBackIn; 51 | extern NSString *const kFTAnimationFadeOut; 52 | extern NSString *const kFTAnimationFadeIn; 53 | extern NSString *const kFTAnimationFadeBackgroundOut; 54 | extern NSString *const kFTAnimationFadeBackgroundIn; 55 | extern NSString *const kFTAnimationPopIn; 56 | extern NSString *const kFTAnimationPopOut; 57 | extern NSString *const kFTAnimationFallIn; 58 | extern NSString *const kFTAnimationFallOut; 59 | extern NSString *const kFTAnimationFlyOut; 60 | 61 | extern NSString *const kFTAnimationTargetViewKey; 62 | 63 | #pragma mark Inline Functions 64 | 65 | /** 66 | Find a `CGPoint` that will cause the *viewFrame* to be placed at the edge or corner of 67 | the *enclosingViewFrame* in the specified *direction*. 68 | 69 | @return A center point which will place the given view at the edge or corner of the *enclosingViewFrame* 70 | 71 | @param enclosingViewFrame The view whose edge or corner will be used to calculate the point 72 | @param viewFrame The rect of the view to be moved 73 | @param viewCenter The center of the view to be moved 74 | @param direction The edge or corner of the *enclosingView* used to calculate the point 75 | */ 76 | static inline CGPoint FTAnimationOutOfViewCenterPoint(CGRect enclosingViewFrame, CGRect viewFrame, CGPoint viewCenter, FTAnimationDirection direction) { 77 | switch (direction) { 78 | case kFTAnimationBottom: { 79 | CGFloat extraOffset = viewFrame.size.height / 2; 80 | return CGPointMake(viewCenter.x, enclosingViewFrame.size.height + extraOffset); 81 | break; 82 | } 83 | case kFTAnimationTop: { 84 | CGFloat extraOffset = viewFrame.size.height / 2; 85 | return CGPointMake(viewCenter.x, enclosingViewFrame.origin.y - extraOffset); 86 | break; 87 | } 88 | case kFTAnimationLeft: { 89 | CGFloat extraOffset = viewFrame.size.width / 2; 90 | return CGPointMake(enclosingViewFrame.origin.x - extraOffset, viewCenter.y); 91 | break; 92 | } 93 | case kFTAnimationRight: { 94 | CGFloat extraOffset = viewFrame.size.width / 2; 95 | return CGPointMake(enclosingViewFrame.size.width + extraOffset, viewCenter.y); 96 | break; 97 | } 98 | case kFTAnimationBottomLeft: { 99 | CGFloat extraOffsetHeight = viewFrame.size.height / 2; 100 | CGFloat extraOffsetWidth = viewFrame.size.width / 2; 101 | return CGPointMake(enclosingViewFrame.origin.x - extraOffsetWidth, enclosingViewFrame.size.height + extraOffsetHeight); 102 | break; 103 | } 104 | case kFTAnimationTopLeft: { 105 | CGFloat extraOffsetHeight = viewFrame.size.height / 2; 106 | CGFloat extraOffsetWidth = viewFrame.size.width / 2; 107 | return CGPointMake(enclosingViewFrame.origin.x - extraOffsetWidth, enclosingViewFrame.origin.y - extraOffsetHeight); 108 | break; 109 | } 110 | case kFTAnimationBottomRight: { 111 | CGFloat extraOffsetHeight = viewFrame.size.height / 2; 112 | CGFloat extraOffsetWidth = viewFrame.size.width / 2; 113 | return CGPointMake(enclosingViewFrame.size.width + extraOffsetWidth, enclosingViewFrame.size.height + extraOffsetHeight); 114 | break; 115 | } 116 | case kFTAnimationTopRight: { 117 | CGFloat extraOffsetHeight = viewFrame.size.height / 2; 118 | CGFloat extraOffsetWidth = viewFrame.size.width / 2; 119 | return CGPointMake(enclosingViewFrame.size.width + extraOffsetWidth, enclosingViewFrame.origin.y - extraOffsetHeight); 120 | break; 121 | } 122 | } 123 | return CGPointZero; 124 | } 125 | 126 | /** 127 | Find a `CGPoint` that will cause the *viewFrame* to be completely offscreen in a specified *direction*. 128 | 129 | @return A center point which will place the given view rect offscreen 130 | 131 | @param viewFrame The view rect to be placed offscreen 132 | @param viewCenter The center of the view to be placed offscreen 133 | @param direction The edge or corner of the screen the view rect will be placed. 134 | */ 135 | static inline CGPoint FTAnimationOffscreenCenterPoint(CGRect viewFrame, CGPoint viewCenter, FTAnimationDirection direction) { 136 | CGRect screenRect = [[UIScreen mainScreen] bounds]; 137 | if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { 138 | CGFloat swap = screenRect.size.height; 139 | screenRect.size.height = screenRect.size.width; 140 | screenRect.size.width = swap; 141 | } 142 | switch (direction) { 143 | case kFTAnimationBottom: { 144 | CGFloat extraOffset = viewFrame.size.height / 2; 145 | return CGPointMake(viewCenter.x, screenRect.size.height + extraOffset); 146 | break; 147 | } 148 | case kFTAnimationTop: { 149 | CGFloat extraOffset = viewFrame.size.height / 2; 150 | return CGPointMake(viewCenter.x, screenRect.origin.y - extraOffset); 151 | break; 152 | } 153 | case kFTAnimationLeft: { 154 | CGFloat extraOffset = viewFrame.size.width / 2; 155 | return CGPointMake(screenRect.origin.x - extraOffset, viewCenter.y); 156 | break; 157 | } 158 | case kFTAnimationRight: { 159 | CGFloat extraOffset = viewFrame.size.width / 2; 160 | return CGPointMake(screenRect.size.width + extraOffset, viewCenter.y); 161 | break; 162 | } 163 | default: 164 | break; 165 | } 166 | return FTAnimationOutOfViewCenterPoint([[UIScreen mainScreen] bounds], viewFrame, viewCenter, direction); 167 | } 168 | 169 | /** 170 | The FTAnimationManager class is the heart of the FTUtils Core Animation utilities. It is 171 | meant to be used as a singleton. Developers should avoid creating mulitple instances 172 | and should get a reference to an instance via the sharedManager class method. 173 | */ 174 | @interface FTAnimationManager : NSObject { 175 | @private 176 | CGFloat overshootThreshold_; 177 | } 178 | 179 | /** 180 | The maximum value (in points) that the bouncing animations will travel past their 181 | end value before coming to rest. The default is 10.0. 182 | */ 183 | @property(assign) CGFloat overshootThreshold; 184 | 185 | ///--------------------------------------------------------------------------- 186 | /// @name Accessing the animation manager 187 | ///--------------------------------------------------------------------------- 188 | /** 189 | Get a reference to the FTAnimationManager singleton creating it if necessary. 190 | 191 | @return The singleton. 192 | */ 193 | + (FTAnimationManager *)sharedManager; 194 | 195 | ///--------------------------------------------------------------------------- 196 | /// @name Controlling animation timing 197 | ///--------------------------------------------------------------------------- 198 | 199 | /** 200 | Wraps a `CAAnimation` in a `CAAnimationGroup` which will delay the start of 201 | the animation once it is added to a `CALayer`. 202 | 203 | @param animation The animation to be delayed 204 | @param delayTime The duration (in seconds) of the delay 205 | */ 206 | - (CAAnimationGroup *)delayStartOfAnimation:(CAAnimation *)animation withDelay:(CFTimeInterval)delayTime; 207 | 208 | /** 209 | Wraps a `CAAnimation` in a `CAAnimationGroup` which will delay the firing of the 210 | `animationDidStop:finished:` delegate method once the animation has stopped. 211 | 212 | @param animation The animation to be delayed 213 | @param delayTime The duration (in seconds) of the delay 214 | */ 215 | - (CAAnimationGroup *)pauseAtEndOfAnimation:(CAAnimation *)animation withDelay:(CFTimeInterval)delayTime; 216 | 217 | /** 218 | Chains a sequence of animation objects to be run sequentially. 219 | 220 | @warning *Important:* The animation chaining only works with animations created 221 | with one of the FTAnimationManager animations. If you want to sequence your own 222 | `CAAnimation` objects, you must wrap each of them with the 223 | animationGroupFor:withView:duration:delegate:startSelector:stopSelector:name:type: 224 | method. 225 | 226 | @param animations An array of animations to be run sequentially 227 | @param run If `YES`, the sequence begins immediately after this method returns. If 228 | `NO`, you must add the returned `CAAnimation` object to a `CALayer` to begin the 229 | sequence. 230 | */ 231 | - (CAAnimation *)chainAnimations:(NSArray *)animations run:(BOOL)run; 232 | 233 | /** 234 | Groups a list of `CAAnimations` and associates them with _view_. All animations 235 | created by FTAnimationManager are ultimately created by this method. 236 | 237 | @param animations A list of animations to group together. 238 | @param view The target view for the _animations_. 239 | @param duration The duration (in seconds) of the returned animation group. 240 | @param delegate An optional delegate to send animation start and stop messages to. 241 | @param startSelector An optional selector to be called on _delegate_ when the animation starts. 242 | @param stopSelector An optional selector to be called on _delegate_ when the animation stops. 243 | @param name A unique name used as a key internally to store and retrieve this animation object. 244 | @param type Either kFTAnimationTypeIn or kFTAnimationTypeOut to denote whether this animation 245 | is designed to show or hide its associated _view_. 246 | */ 247 | - (CAAnimationGroup *)animationGroupFor:(NSArray *)animations withView:(UIView *)view 248 | duration:(NSTimeInterval)duration delegate:(id)delegate 249 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector 250 | name:(NSString *)name type:(NSString *)type; 251 | 252 | ///--------------------------------------------------------------------------- 253 | /// @name Creating animation objects 254 | ///--------------------------------------------------------------------------- 255 | 256 | /** 257 | Slides a view in from offscreen 258 | */ 259 | - (CAAnimation *)slideInAnimationFor:(UIView *)view direction:(FTAnimationDirection)direction 260 | duration:(NSTimeInterval)duration delegate:(id)delegate 261 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 262 | /** 263 | Slides a view offscreen 264 | */ 265 | - (CAAnimation *)slideOutAnimationFor:(UIView *)view direction:(FTAnimationDirection)direction 266 | duration:(NSTimeInterval)duration delegate:(id)delegate 267 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 268 | 269 | /** 270 | Slides a view in from offscreen 271 | */ 272 | - (CAAnimation *)slideInAnimationFor:(UIView *)view direction:(FTAnimationDirection)direction inView:(UIView*)enclosingView 273 | duration:(NSTimeInterval)duration delegate:(id)delegate 274 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 275 | 276 | /** 277 | Slides a view offscreen 278 | */ 279 | - (CAAnimation *)slideOutAnimationFor:(UIView *)view direction:(FTAnimationDirection)direction inView:(UIView*)enclosingView 280 | duration:(NSTimeInterval)duration delegate:(id)delegate 281 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 282 | 283 | /** 284 | Backs a view offscreen 285 | */ 286 | - (CAAnimation *)backOutAnimationFor:(UIView *)view withFade:(BOOL)fade direction:(FTAnimationDirection)direction 287 | duration:(NSTimeInterval)duration delegate:(id)delegate 288 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 289 | 290 | /** 291 | Backs a view in from offscreen 292 | */ 293 | - (CAAnimation *)backInAnimationFor:(UIView *)view withFade:(BOOL)fade direction:(FTAnimationDirection)direction 294 | duration:(NSTimeInterval)duration delegate:(id)delegate 295 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 296 | /** 297 | Backs a view offscreen 298 | */ 299 | - (CAAnimation *)backOutAnimationFor:(UIView *)view withFade:(BOOL)fade direction:(FTAnimationDirection)direction inView:(UIView*)enclosingView 300 | duration:(NSTimeInterval)duration delegate:(id)delegate 301 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 302 | /** 303 | Backs a view in from offscreen 304 | */ 305 | - (CAAnimation *)backInAnimationFor:(UIView *)view withFade:(BOOL)fade direction:(FTAnimationDirection)direction inView:(UIView*)enclosingView 306 | duration:(NSTimeInterval)duration delegate:(id)delegate 307 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 308 | 309 | /** 310 | Aniamtes the `alpha` of the _view_. 311 | */ 312 | - (CAAnimation *)fadeAnimationFor:(UIView *)view duration:(NSTimeInterval)duration 313 | delegate:(id)delegate startSelector:(SEL)startSelector 314 | stopSelector:(SEL)stopSelector fadeOut:(BOOL)fadeOut; 315 | 316 | /** 317 | Animates the `backgroundColor` of the _view_. 318 | */ 319 | - (CAAnimation *)fadeBackgroundColorAnimationFor:(UIView *)view duration:(NSTimeInterval)duration 320 | delegate:(id)delegate startSelector:(SEL)startSelector 321 | stopSelector:(SEL)stopSelector fadeOut:(BOOL)fadeOut; 322 | 323 | /** 324 | Pops a view in from offscreen 325 | */ 326 | - (CAAnimation *)popInAnimationFor:(UIView *)view duration:(NSTimeInterval)duration delegate:(id)delegate 327 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 328 | 329 | /** 330 | Pops a view offscreen 331 | */ 332 | - (CAAnimation *)popOutAnimationFor:(UIView *)view duration:(NSTimeInterval)duration delegate:(id)delegate 333 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 334 | 335 | /** 336 | Shrinks and fades out view. 337 | */ 338 | - (CAAnimation *)fallInAnimationFor:(UIView *)view duration:(NSTimeInterval)duration delegate:(id)delegate 339 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 340 | 341 | /** 342 | Shrinks and fades in view which starts scaled to double of its original size. 343 | */ 344 | - (CAAnimation *)fallOutAnimationFor:(UIView *)view duration:(NSTimeInterval)duration delegate:(id)delegate 345 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 346 | 347 | /** 348 | Scales up and fades out a view. 349 | */ 350 | - (CAAnimation *)flyOutAnimationFor:(UIView *)view duration:(NSTimeInterval)duration delegate:(id)delegate 351 | startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector; 352 | 353 | 354 | @end 355 | 356 | /** 357 | This category on `CAAnimation` allows for using individual selectors 358 | on arbitrary objects to respond the `CAAnimationDelegate` calls. 359 | 360 | @warning *Important:* You must not set the `CAAnimation` `delegate` property 361 | when using a start or stop selector. If you call setStartSelector:withTarget: or 362 | setStopSelector:withTarget: the `CAAnimation`'s `delegate` will be overwritten. 363 | */ 364 | @interface CAAnimation (FTAnimationAdditions) 365 | 366 | /** 367 | Called right before the animation starts. This has the same effect as 368 | implementing the `animationDidStart:` delegate method. 369 | 370 | The selector should accept a single argument of type `CAAnimation`. 371 | 372 | @param selector The selector to call on _target_. 373 | @param target An object to send the `animationDidStart:` message to. 374 | */ 375 | - (void)setStartSelector:(SEL)selector withTarget:(id)target; 376 | 377 | /** 378 | Called right before the animation stops. This has the same effect as 379 | implementing the `animationDidStop:finished:` delegate method. 380 | 381 | The selector should accept a two arguments. The first argument is the 382 | `CAAnimation` object sending the message and the second is a `BOOL` 383 | indicating whether the animation ran to completion. 384 | 385 | @param selector The selector to call on _target_. 386 | @param target An object to send the `animationDidStart:finished:` message to. 387 | */ 388 | - (void)setStopSelector:(SEL)selector withTarget:(id)target; 389 | 390 | @end 391 | -------------------------------------------------------------------------------- /Headers/FTUtils/FTUtils+NSObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface NSObject (FTUtilsAdditions) 28 | 29 | - (void)performSelector:(SEL)selector andReturnTo:(void *)returnData withArguments:(void **)arguments; 30 | - (void)performSelector:(SEL)selector withArguments:(void **)arguments; 31 | - (void)performSelectorIfExists:(SEL)selector andReturnTo:(void *)returnData withArguments:(void **)arguments; 32 | - (void)performSelectorIfExists:(SEL)selector withArguments:(void **)arguments; 33 | 34 | @end 35 | 36 | @interface NSArray (FTUtilsAdditions) 37 | 38 | /** 39 | Returns a new `NSArray` with the elements in reverse order. 40 | */ 41 | - (NSArray *)reversedArray; 42 | 43 | @end 44 | 45 | @interface NSMutableArray (FTUtilsAdditions) 46 | 47 | /** 48 | Reorders the elements of the array in place. 49 | */ 50 | - (void)reverse; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Headers/FTUtils/FTUtils+UIGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2011 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #if NS_BLOCKS_AVAILABLE 26 | 27 | typedef void (^FTGestureActionBlock)(id recognizer); 28 | 29 | /** 30 | This category defines methods and properties which allow the use of blocks 31 | for working with `UIGestureRecognizer` and its subclasses. 32 | 33 | For more information on working with gestures in iOS, see Apple's 34 | [Event Handling Guide for iOS][1]. 35 | 36 | [1]:http://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html 37 | */ 38 | @interface UIGestureRecognizer(FTBlockAdditions) 39 | 40 | #pragma mark - Creating a block based Gesture Recognizer 41 | 42 | ///--------------------------------------------------------------------------- 43 | /// @name Creating a block based Gesture Recognizer 44 | ///--------------------------------------------------------------------------- 45 | 46 | /** 47 | Creates an autoreleased instance of a `UIGestureRecognizer` subclass with 48 | its actionBlock set to `nil`. 49 | 50 | @warning *Important:* Until the actionBlock is set, the returned object will do nothing. 51 | 52 | @return An instance of a `UIGestureRecognizer` subclass. 53 | @see actionBlock 54 | */ 55 | + (id)recognizer; 56 | 57 | /** 58 | Creates an autoreleased instance of a `UIGestureRecognizer` subclass which 59 | uses _action_ to handle gesture actions. 60 | 61 | @return An instance of a `UIGestureRecognizer` subclass. 62 | @param action A block which will handle the gesture actions. 63 | @see actionBlock 64 | */ 65 | + (id)recognizerWithActionBlock:(FTGestureActionBlock)action; 66 | 67 | #pragma mark - Setting and getting the action handler blocks 68 | 69 | ///--------------------------------------------------------------------------- 70 | /// @name Setting and getting the action handler blocks 71 | ///--------------------------------------------------------------------------- 72 | 73 | /** 74 | A block to be executed when a `UIGestureRecognizer` action is fired. 75 | 76 | The block is passed a single parameter which is the `UIGestureRecognizer` 77 | instance for this property. 78 | */ 79 | @property (copy) FTGestureActionBlock actionBlock; 80 | 81 | /** 82 | A property indicating that the block should *not* be called when 83 | the recognizer fires. 84 | 85 | Useful if you need to temporarily disable an action but you still 86 | want the block to be around later on. 87 | */ 88 | @property (nonatomic, assign) BOOL disabled; 89 | 90 | @end 91 | 92 | #endif -------------------------------------------------------------------------------- /Headers/FTUtils/FTUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | /** 26 | A collection of macros used throughout the FTUtils set of tools. 27 | 28 | This file need not be included directly since it's included by the other 29 | pieces of the library. The macros are useful throughout a project, and 30 | it's recommended that you just include the file in your prefix header. 31 | */ 32 | 33 | #pragma mark - Version 34 | 35 | static const NSUInteger FTUtilsVersion = 010100; 36 | static NSString *const FTUtilsVersionString = @"1.1.0"; 37 | 38 | #pragma mark - Logging 39 | ///--------------------------------------------------------------------------- 40 | /// @name Logging Messages to the Console 41 | ///--------------------------------------------------------------------------- 42 | 43 | // FTLOGEXT logging macro from: http://iphoneincubator.com/blog/debugging/the-evolution-of-a-replacement-for-nslog 44 | #ifdef DEBUG 45 | 46 | /** 47 | A simple wrapper for `NSLog()` that is automatically removed from release builds. 48 | */ 49 | #define FTLOG(...) NSLog(__VA_ARGS__) 50 | 51 | /** 52 | More detailed loogging. Logs the function name and line number after the log message. 53 | */ 54 | #define FTLOGEXT(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); 55 | 56 | /** 57 | Logs a method call's class and selector. 58 | */ 59 | #define FTLOGCALL FTLOG(@"[%@ %@]", NSStringFromClass([self class]), NSStringFromSelector(_cmd)) 60 | 61 | #else 62 | #define FTLOG(...) /* */ 63 | #define FTLOGEXT(...) /* */ 64 | #define FTLOGCALL /* */ 65 | #endif 66 | 67 | #pragma mark - Memory Management 68 | ///--------------------------------------------------------------------------- 69 | /// @name Memory Management 70 | ///--------------------------------------------------------------------------- 71 | 72 | /** 73 | Safely release an objective-c object and set its variable to `nil`. 74 | */ 75 | #define FTRELEASE(_obj) [_obj release], _obj = nil 76 | 77 | /** 78 | Safely free a pointer and set its variable to `NULL`. 79 | */ 80 | #define FTFREE(_ptr) if(_ptr != NULL) { free(_ptr); _ptr = NULL; } 81 | 82 | #pragma mark - Math 83 | ///--------------------------------------------------------------------------- 84 | /// @name Math Helpers 85 | ///--------------------------------------------------------------------------- 86 | 87 | /** Convert from degrees to radians */ 88 | #define DEGREES_TO_RADIANS(d) (d * M_PI / 180) 89 | 90 | /** Convert from radians to degrees */ 91 | #define RADIANS_TO_DEGREES(r) (r * 180 / M_PI) 92 | 93 | #pragma mark - Colors 94 | ///--------------------------------------------------------------------------- 95 | /// @name Creating colors 96 | ///--------------------------------------------------------------------------- 97 | 98 | /** 99 | Create a UIColor with r,g,b values between 0.0 and 1.0. 100 | */ 101 | #define RGBCOLOR(r,g,b) \ 102 | [UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:1.f] 103 | 104 | /** 105 | Create a UIColor with r,g,b,a values between 0.0 and 1.0. 106 | */ 107 | #define RGBACOLOR(r,g,b,a) \ 108 | [UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:a] 109 | 110 | /** 111 | Create a UIColor from a hex value. 112 | 113 | For example, `UIColorFromRGB(0xFF0000)` creates a `UIColor` object representing 114 | the color red. 115 | */ 116 | #define UIColorFromRGB(rgbValue) \ 117 | [UIColor \ 118 | colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 119 | green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ 120 | blue:((float)(rgbValue & 0x0000FF))/255.0 \ 121 | alpha:1.0] 122 | 123 | /** 124 | Create a UIColor with an alpha value from a hex value. 125 | 126 | For example, `UIColorFromRGBA(0xFF0000, .5)` creates a `UIColor` object 127 | representing a half-transparent red. 128 | */ 129 | #define UIColorFromRGBA(rgbValue, alphaValue) \ 130 | [UIColor \ 131 | colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 132 | green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ 133 | blue:((float)(rgbValue & 0x0000FF))/255.0 \ 134 | alpha:alphaValue] 135 | 136 | #pragma mark - Delegates 137 | ///--------------------------------------------------------------------------- 138 | /// @name Calling Delegates 139 | ///--------------------------------------------------------------------------- 140 | 141 | /** 142 | Call a delegate method if the selector exists. 143 | */ 144 | #define FT_CALL_DELEGATE(_delegate, _selector) \ 145 | do { \ 146 | id _theDelegate = _delegate; \ 147 | if(_theDelegate != nil && [_theDelegate respondsToSelector:_selector]) { \ 148 | [_theDelegate performSelector:_selector]; \ 149 | } \ 150 | } while(0); 151 | 152 | /** 153 | Call a delegate method that accepts one argument if the selector exists. 154 | */ 155 | #define FT_CALL_DELEGATE_WITH_ARG(_delegate, _selector, _argument) \ 156 | do { \ 157 | id _theDelegate = _delegate; \ 158 | if(_theDelegate != nil && [_theDelegate respondsToSelector:_selector]) { \ 159 | [_theDelegate performSelector:_selector withObject:_argument]; \ 160 | } \ 161 | } while(0); 162 | 163 | /** 164 | Call a delegate method that accepts two arguments if the selector exists. 165 | */ 166 | #define FT_CALL_DELEGATE_WITH_ARGS(_delegate, _selector, _arg1, _arg2) \ 167 | do { \ 168 | id _theDelegate = _delegate; \ 169 | if(_theDelegate != nil && [_theDelegate respondsToSelector:_selector]) { \ 170 | [_theDelegate performSelector:_selector withObject:_arg1 withObject:_arg2]; \ 171 | } \ 172 | } while(0); 173 | 174 | #pragma mark - File System 175 | ///--------------------------------------------------------------------------- 176 | /// @name Working with the filesystem 177 | ///--------------------------------------------------------------------------- 178 | 179 | /** 180 | Get the full path for a file name in the documents directory. 181 | 182 | @param filename the name of the file _(the file need not exist yet)_. 183 | @return The full path to the filename. 184 | */ 185 | static inline NSString *FTPathForFileInDocumentsDirectory(NSString *filename) { 186 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 187 | NSString *documentsDirectory = [paths objectAtIndex:0]; 188 | NSString *path = [documentsDirectory stringByAppendingPathComponent:filename]; 189 | return path; 190 | } 191 | 192 | #pragma mark - Core Data 193 | ///--------------------------------------------------------------------------- 194 | /// @name Working with the Core Data 195 | ///--------------------------------------------------------------------------- 196 | 197 | /** 198 | Save a Core Data `NSManagedObjectContext` and pretty print any errors. 199 | */ 200 | #define FT_SAVE_MOC(_ft_moc) \ 201 | do { \ 202 | NSError* _ft_save_error; \ 203 | if(![_ft_moc save:&_ft_save_error]) { \ 204 | FTLOG(@"Failed to save to data store: %@", [_ft_save_error localizedDescription]); \ 205 | NSArray* _ft_detailedErrors = [[_ft_save_error userInfo] objectForKey:NSDetailedErrorsKey]; \ 206 | if(_ft_detailedErrors != nil && [_ft_detailedErrors count] > 0) { \ 207 | for(NSError* _ft_detailedError in _ft_detailedErrors) { \ 208 | FTLOG(@"DetailedError: %@", [_ft_detailedError userInfo]); \ 209 | } \ 210 | } \ 211 | else { \ 212 | FTLOG(@"%@", [_ft_save_error userInfo]); \ 213 | } \ 214 | } \ 215 | } while(0); 216 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.freetimestudios.${PRODUCT_NAME:identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | NSMainNibFile 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2009 Free Time Studios and Nathan Eror 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | XCODEBUILD ?= xcodebuild 2 | SIMULATOR_SDK ?= iphonesimulator4.0 3 | DEVICE_SDK ?= iphoneos4.0 4 | BUILD_TARGET ?= FTUtils 5 | BUILD_ARGS=-target $(BUILD_TARGET) -sdk $(SIMULATOR_SDK) -configuration 6 | 7 | CLOC ?= $(HOME)/Work/cloc-1.07.pl 8 | CLOC_ARGS=--force-lang="Objective C",m --exclude-dir=Support,build,.git,Tests,Classes/GameObjects,../../iphone --no3 9 | 10 | APPLEDOC ?= appledoc 11 | APPLEDOC_TEMPLATE_DIR ?= apidocs/.templates 12 | APPLEDOC_OPTS = --output apidocs \ 13 | --templates $(APPLEDOC_TEMPLATE_DIR) \ 14 | --project-name FTUtils \ 15 | --project-version $(shell cat VERSION) \ 16 | --project-company "Free Time Studios, LLC" \ 17 | --company-id com.freetimestudios \ 18 | --create-html \ 19 | --no-create-docset \ 20 | --no-install-docset \ 21 | --no-publish-docset \ 22 | --keep-intermediate-files \ 23 | --verbose 0 24 | APPLEDOC_EXTRA_OPTS ?= 25 | 26 | all: cleandebug test 27 | 28 | cleandocs: 29 | rm -rf apidocs/html 30 | rm -rf apidocs/docset 31 | rm -rf apidocs/publish 32 | 33 | docs: cleandocs 34 | $(APPLEDOC) $(APPLEDOC_OPTS) $(APPLEDOC_EXTRA_OPTS) Headers 35 | 36 | docset: cleandocs 37 | $(APPLEDOC) $(APPLEDOC_OPTS) --create-docset $(APPLEDOC_EXTRA_OPTS) Headers 38 | 39 | docsetinstall: cleandocs 40 | $(APPLEDOC) $(APPLEDOC_OPTS) --create-docset --install-docset $(APPLEDOC_EXTRA_OPTS) Headers 41 | 42 | docsetpublish: cleandocs 43 | $(APPLEDOC) $(APPLEDOC_OPTS) --create-docset \ 44 | --install-docset \ 45 | --publish-docset \ 46 | --docset-feed-url http://ftutils.com/docs/api/docset/%DOCSETATOMFILENAME \ 47 | --docset-package-url http://ftutils.com/docs/api/docset/%DOCSETPACKAGEFILENAME \ 48 | $(APPLEDOC_EXTRA_OPTS) Headers 49 | 50 | clean: cleandebug cleanrelease 51 | 52 | count: 53 | $(CLOC) $(CLOC_ARGS) . 54 | 55 | countfile: 56 | $(CLOC) $(CLOC_ARGS) --by-file . 57 | 58 | debug: 59 | $(XCODEBUILD) $(BUILD_ARGS) Debug 60 | 61 | release: 62 | $(XCODEBUILD) $(BUILD_ARGS) Release 63 | 64 | devicerelease: 65 | $(XCODEBUILD) -target $(BUILD_TARGET) -sdk $(DEVICE_SDK) -configuration Release 66 | 67 | cleandebug: 68 | $(XCODEBUILD) $(BUILD_ARGS) Debug clean 69 | 70 | cleanrelease: 71 | $(XCODEBUILD) $(BUILD_ARGS) Release clean 72 | 73 | -------------------------------------------------------------------------------- /README.mdown: -------------------------------------------------------------------------------- 1 | FTUtils iPhone Utility Code Library 2 | =================================== 3 | 4 | The code in FTUtils is common utility code extracted from [Free Time Studios](http://www.freetimestudios.com/) iPhone projects. Currently, there is only one primary utility (`FTAnimationManager`) and some simple preprocessor macros. Some unit tests exist for the code, but more are needed. The documentation is also still under development. 5 | 6 | Setting Up FTUtils 7 | ------------------ 8 | 9 | FTUtils is most easily used by simply copying `FTUtils.h`, `FTAnimationManager.h` and `FTAnimationManager.m` into your project. Be sure to add the QuartzCore framework to your project as well (step 5 below). The preferred way to integrate FTUtils into your projects is by adding it as a static library. This will keep it separate from your code. 10 | 11 | The following is the process to add the FTUtils static library to your Xcode project (these steps were borrowed from the [three20 project](http://github.com/joehewitt/three20/tree/master "joehewitt's three20 at master - GitHub") and modified): 12 | 13 | 1. Clone the ftutils git repository: `git clone git://github.com/neror/ftutils.git`. Make sure you store the repository in a permanent place because Xcode will need to reference the files every time you compile your project. 14 | 15 | 1(a). If you are already using git to manage your source files, you can also add the ftutils repository as a submodule to your project. 16 | 17 | 2. Locate the "FTUtils.xcodeproj" file under "ftutils". Drag FTUtils.xcodeproj and drop it onto the root of your Xcode project's "Groups and Files" sidebar. A dialog will appear -- make sure "Copy items" is unchecked and "Reference Type" is "Relative to Project" before clicking "Add". 18 | 19 | 3. Now you need to link the FTUtils static library to your project. Click the "FTUtils.xcodeproj" item that has just been added to the sidebar. Under the "Details" table, you will see a single item: libFTUtils.a. Check the checkbox on the far right of libFTUtils.a. 20 | 21 | 4. Now you need to add FTUtils as a dependency of your project, so Xcode compiles it whenever you compile your project. Expand the "Targets" section of the sidebar and double-click your application's target. Under the "General" tab you will see a "Direct Dependencies" section. Click the "+" button, select "FTUtils", and click "Add Target". 22 | 23 | 5. Now you need to add the Core Animation framework to your project. Right click on the "Frameworks" group in your project (or equivalent) and select Add > Existing Frameworks. Then locate QuartzCore.framework and add it to the project. 24 | 25 | 6. Finally, we need to tell your project where to find the FTUtils headers. Open your "Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click it. Add the relative path from your project's directory to the "ftutils/Headers" directory. 26 | 27 | 7. While you are in Project Settings, go to "Other Linker Flags" under the "Linker" section, and add "-ObjC" and "-all_load" to the list of flags. 28 | 29 | You're ready to go! Just import the header(s) in your code for the parts of the library you'd like to use. The FTAnimation.h header includes everything in the library. So you can just include it: 30 | 31 | #import 32 | 33 | Enjoy! And extra super special thanks to [Joe Hewitt](http://www.joehewitt.com/ "Joe Hewitt") for writing these steps out for his [three20 project](http://github.com/joehewitt/three20/tree/master "joehewitt's three20 at master - GitHub")! I don't think I have the patience to pull it off. 34 | 35 | Using FTAnimation 36 | ----------------- 37 | 38 | FTAnimation was designed to make complex Core Animation based animations simple to create and use. The primary interface into the pre-built animations is a category on `UIView`. Animating a view is as simple as: 39 | 40 | [myView slideInFrom:kFTAnimationBottom duration:.33f delegate:self]; 41 | 42 | You can also access the `CAAnimation` instances that power the category methods via the `FTAnimationManager` singleton like so: 43 | 44 | CAAnimation *anim = [[FTAnimationManager sharedManager] slideInAnimationFor:myView direction:kFTAnimationBottom 45 | duration:.33f delegate:self]; 46 | 47 | modify it to your satisfaction and/or add it to a `CAAnimationGroup` and add it to the view's layer when you're ready to use it: 48 | 49 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInOut]; 50 | [myView.layer addAnimation:anim forKey:@"MySpecialAnimation"]; 51 | 52 | See the code for details. 53 | 54 | The FTAnimation UIView Category 55 | ------------------------------- 56 | 57 | FTAnimation ships with 13 canned `UIView` animations for animating the showing and hiding of views in the interface. These animations are all available through a category on the `UIView` class. 58 | 59 | 60 | 61 | Contributors 62 | ------------ 63 | 64 | FTUtils was written by [Nathan Eror](http://www.neror.com/ "neror.com") ([@neror](http://twitter.com/neror)) for use in iPhone games built and distributed by [Free Time Studios](http://www.freetimestudios.com/ "Free Time Studios") ([@freetimestudios](http://twitter.com/freetimestudios)). 65 | 66 | License 67 | ------- 68 | The MIT License 69 | 70 | Copyright (c) 2009 Free Time Studios and Nathan Eror 71 | 72 | Permission is hereby granted, free of charge, to any person obtaining a copy 73 | of this software and associated documentation files (the "Software"), to deal 74 | in the Software without restriction, including without limitation the rights 75 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 76 | copies of the Software, and to permit persons to whom the Software is 77 | furnished to do so, subject to the following conditions: 78 | 79 | The above copyright notice and this permission notice shall be included in 80 | all copies or substantial portions of the Software. 81 | 82 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 83 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 84 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 85 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 86 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 87 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 88 | THE SOFTWARE. 89 | 90 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /Support/OCMock.framework/OCMock: -------------------------------------------------------------------------------- 1 | Versions/Current/OCMock -------------------------------------------------------------------------------- /Support/OCMock.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Headers/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------- 2 | // $Id: NSNotificationCenter+OCMAdditions.h$ 3 | // Copyright (c) 2009 by Mulle Kybernetik. See License file for details. 4 | //--------------------------------------------------------------------------------------- 5 | 6 | #import 7 | 8 | @class OCMockObserver; 9 | 10 | 11 | @interface NSNotificationCenter(OCMAdditions) 12 | 13 | - (void)addMockObserver:(OCMockObserver *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Headers/OCMArg.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------- 2 | // $Id: $ 3 | // Copyright (c) 2009 by Mulle Kybernetik. See License file for details. 4 | //--------------------------------------------------------------------------------------- 5 | 6 | #import 7 | 8 | @interface OCMArg : NSObject 9 | 10 | // constraining arguments 11 | 12 | + (id)any; 13 | + (void *)anyPointer; 14 | + (id)isNil; 15 | + (id)isNotNil; 16 | + (id)isNotEqual:(id)value; 17 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; 18 | 19 | // manipulating arguments 20 | 21 | + (id *)setTo:(id)value; 22 | 23 | // internal use only 24 | 25 | + (id)resolveSpecialValues:(NSValue *)value; 26 | 27 | @end 28 | 29 | #define OCMOCK_ANY [OCMArg any] 30 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(typeof(variable))] 31 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Headers/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------- 2 | // $Id: $ 3 | // Copyright (c) 2007-2009 by Mulle Kybernetik. See License file for details. 4 | //--------------------------------------------------------------------------------------- 5 | 6 | #import 7 | 8 | @interface OCMConstraint : NSObject 9 | 10 | + (id)constraint; 11 | - (BOOL)evaluate:(id)value; 12 | 13 | // if you are looking for any, isNil, etc, they have moved to OCMArg 14 | 15 | + (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; 16 | + (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; 17 | 18 | // try to use [OCMArg checkWith...] instead of constraintWithSelector in here 19 | 20 | @end 21 | 22 | @interface OCMAnyConstraint : OCMConstraint 23 | @end 24 | 25 | @interface OCMIsNilConstraint : OCMConstraint 26 | @end 27 | 28 | @interface OCMIsNotNilConstraint : OCMConstraint 29 | @end 30 | 31 | @interface OCMIsNotEqualConstraint : OCMConstraint 32 | { 33 | @public 34 | id testValue; 35 | } 36 | 37 | @end 38 | 39 | @interface OCMInvocationConstraint : OCMConstraint 40 | { 41 | @public 42 | NSInvocation *invocation; 43 | } 44 | 45 | @end 46 | 47 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] 48 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] 49 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Headers/OCMock.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------- 2 | // $Id$ 3 | // Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. 4 | //--------------------------------------------------------------------------------------- 5 | 6 | #import 7 | #import 8 | #import 9 | #import 10 | #import 11 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Headers/OCMockObject.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------- 2 | // $Id$ 3 | // Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. 4 | //--------------------------------------------------------------------------------------- 5 | 6 | #import 7 | 8 | @interface OCMockObject : NSProxy 9 | { 10 | BOOL isNice; 11 | NSMutableArray *recorders; 12 | NSMutableSet *expectations; 13 | NSMutableArray *exceptions; 14 | } 15 | 16 | + (id)mockForClass:(Class)aClass; 17 | + (id)mockForProtocol:(Protocol *)aProtocol; 18 | + (id)partialMockForObject:(NSObject *)anObject; 19 | 20 | + (id)niceMockForClass:(Class)aClass; 21 | + (id)niceMockForProtocol:(Protocol *)aProtocol; 22 | 23 | + (id)observerMock; 24 | 25 | - (id)init; 26 | 27 | - (id)stub; 28 | - (id)expect; 29 | 30 | - (void)verify; 31 | 32 | // internal use only 33 | 34 | - (id)getNewRecorder; 35 | - (BOOL)handleInvocation:(NSInvocation *)anInvocation; 36 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Headers/OCMockRecorder.h: -------------------------------------------------------------------------------- 1 | //--------------------------------------------------------------------------------------- 2 | // $Id$ 3 | // Copyright (c) 2004-2009 by Mulle Kybernetik. See License file for details. 4 | //--------------------------------------------------------------------------------------- 5 | 6 | #import 7 | 8 | @interface OCMockRecorder : NSProxy 9 | { 10 | id signatureResolver; 11 | NSInvocation *recordedInvocation; 12 | NSMutableArray *invocationHandlers; 13 | } 14 | 15 | - (id)initWithSignatureResolver:(id)anObject; 16 | 17 | - (BOOL)matchesInvocation:(NSInvocation *)anInvocation; 18 | - (void)releaseInvocation; 19 | 20 | - (id)andReturn:(id)anObject; 21 | - (id)andReturnValue:(NSValue *)aValue; 22 | - (id)andThrow:(NSException *)anException; 23 | - (id)andPost:(NSNotification *)aNotification; 24 | - (id)andCall:(SEL)selector onObject:(id)anObject; 25 | 26 | - (NSArray *)invocationHandlers; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/OCMock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/Support/OCMock.framework/Versions/A/OCMock -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | OCMock 9 | CFBundleIdentifier 10 | com.mulle-kybernetik.OCMock 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | OCMock 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.29 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSHumanReadableCopyright 24 | Copyright © 2004-2009 Mulle Kybernetik. 25 | 26 | 27 | -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/A/Resources/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2004-2009 by Mulle Kybernetik. All rights reserved. 3 | 4 | Permission to use, copy, modify and distribute this software and its documentation 5 | is hereby granted, provided that both the copyright notice and this permission 6 | notice appear in all copies of the software, derivative works or modified versions, 7 | and any portions thereof, and that both notices appear in supporting documentation, 8 | and that credit is given to Mulle Kybernetik in all documents and publicity 9 | pertaining to direct or indirect use of this code or its derivatives. 10 | 11 | THIS IS EXPERIMENTAL SOFTWARE AND IT IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE 12 | SERIOUS CONSEQUENCES. THE COPYRIGHT HOLDER ALLOWS FREE USE OF THIS SOFTWARE IN ITS 13 | "AS IS" CONDITION. THE COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY 14 | DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE 15 | OR OF ANY DERIVATIVE WORK. -------------------------------------------------------------------------------- /Support/OCMock.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Tests/TestFTAnimationManager.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import 27 | 28 | @interface TestFTAnimationManager : SenTestCase { 29 | UIView *rootView; 30 | UIView *dummyView; 31 | } 32 | @end 33 | 34 | @implementation TestFTAnimationManager 35 | 36 | - (void)setUp { 37 | rootView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 38 | dummyView = [[UIView alloc] initWithFrame:CGRectMake(135.f, 215.f, 50.f, 50.f)]; 39 | [rootView addSubview:dummyView]; 40 | } 41 | 42 | - (void)tearDown { 43 | [dummyView removeFromSuperview]; 44 | [dummyView release]; 45 | dummyView = nil; 46 | [rootView release]; 47 | rootView = nil; 48 | } 49 | 50 | - (void)testOffscreenCenterFor { 51 | CGPoint startCenter = CGPointMake(160.f, 240.f); 52 | CGRect screenBounds = [[UIScreen mainScreen] bounds]; 53 | CGFloat expectedOffset = [dummyView frame].size.height / 2; 54 | 55 | // Sanity check 56 | STAssertEquals([dummyView frame].size.height, [dummyView frame].size.width, @"dummyView is supposed to be a square"); 57 | STAssertEquals(startCenter, [dummyView center], @"dummyView is not in the center of the screen: %@", NSStringFromCGPoint([dummyView center])); 58 | 59 | // Bottom 60 | CGFloat bottomExpected = screenBounds.size.height + expectedOffset; 61 | CGFloat bottomActual = FTAnimationOffscreenCenterPoint(dummyView.frame, dummyView.center, kFTAnimationBottom).y; 62 | STAssertEquals(bottomExpected, bottomActual, @"Bottom y should be %f, was %f", bottomExpected, bottomActual); 63 | 64 | // Top 65 | CGFloat topExpected = screenBounds.origin.y - expectedOffset; 66 | CGFloat topActual = FTAnimationOffscreenCenterPoint(dummyView.frame, dummyView.center, kFTAnimationTop).y; 67 | STAssertEquals(topExpected, topActual, @"Top y should be %f, was %f", topExpected, topActual); 68 | 69 | // Right 70 | CGFloat rightExpected = screenBounds.size.width + expectedOffset; 71 | CGFloat rightActual = FTAnimationOffscreenCenterPoint(dummyView.frame, dummyView.center, kFTAnimationRight).x; 72 | STAssertEquals(rightExpected, rightActual, @"Right x should be %f, was %f", rightExpected, rightActual); 73 | 74 | // Left 75 | CGFloat leftExpected = screenBounds.origin.x - expectedOffset; 76 | CGFloat leftActual = FTAnimationOffscreenCenterPoint(dummyView.frame, dummyView.center, kFTAnimationLeft).x; 77 | STAssertEquals(leftExpected, leftActual, @"Left x should be %f, was %f", leftExpected, leftActual); 78 | } 79 | 80 | - (void)verifyBounceAnimation:(CAAnimation *)animation uses:(int)count pathPoints:(CGPoint[])points { 81 | CAAnimationGroup *group = (CAAnimationGroup *)animation; 82 | CAKeyframeAnimation *keyframeAnimation = [[group animations] objectAtIndex:0]; 83 | CGMutablePathRef expectedPath = CGPathCreateMutable(); 84 | CGPathAddLines(expectedPath, NULL, points, count); 85 | STAssertTrue(CGPathEqualToPath(expectedPath, keyframeAnimation.path), @"Incorrect animation path for animation %@", animation); 86 | CGPathRelease(expectedPath); 87 | } 88 | 89 | - (void)testBackOutAnimationBuilder { 90 | FTAnimationManager *animationManager = [FTAnimationManager sharedManager]; 91 | CGRect screenBounds = [[UIScreen mainScreen] bounds]; 92 | 93 | CGPoint bounceOutBottomPoints[] = { 94 | dummyView.center, 95 | CGPointMake(dummyView.center.x, dummyView.center.y - [animationManager overshootThreshold]), 96 | CGPointMake(dummyView.center.x, screenBounds.size.height + dummyView.frame.size.height / 2) 97 | }; 98 | CAAnimation *bounceOutBottom = [animationManager backOutAnimationFor:dummyView withFade:NO direction:kFTAnimationBottom 99 | duration:0.1f delegate:nil 100 | startSelector:nil stopSelector:nil]; 101 | [self verifyBounceAnimation:bounceOutBottom uses:3 pathPoints:bounceOutBottomPoints]; 102 | 103 | CGPoint bounceOutTopPoints[] = { 104 | dummyView.center, 105 | CGPointMake(dummyView.center.x, dummyView.center.y + [animationManager overshootThreshold]), 106 | CGPointMake(dummyView.center.x, screenBounds.origin.y - dummyView.frame.size.height / 2) 107 | }; 108 | CAAnimation *bounceOutTop = [animationManager backOutAnimationFor:dummyView withFade:NO direction:kFTAnimationTop 109 | duration:0.1f delegate:nil 110 | startSelector:nil stopSelector:nil]; 111 | [self verifyBounceAnimation:bounceOutTop uses:3 pathPoints:bounceOutTopPoints]; 112 | 113 | CGPoint bounceOutLeftPoints[] = { 114 | dummyView.center, 115 | CGPointMake(dummyView.center.x + [animationManager overshootThreshold], dummyView.center.y), 116 | CGPointMake(screenBounds.origin.x - dummyView.frame.size.width / 2, dummyView.center.y) 117 | }; 118 | CAAnimation *bounceOutLeft = [animationManager backOutAnimationFor:dummyView withFade:NO direction:kFTAnimationLeft 119 | duration:0.1f delegate:nil 120 | startSelector:nil stopSelector:nil]; 121 | [self verifyBounceAnimation:bounceOutLeft uses:3 pathPoints:bounceOutLeftPoints]; 122 | 123 | CGPoint bounceOutRightPoints[] = { 124 | dummyView.center, 125 | CGPointMake(dummyView.center.x - [animationManager overshootThreshold], dummyView.center.y), 126 | CGPointMake(screenBounds.size.width + dummyView.frame.size.width / 2, dummyView.center.y) 127 | }; 128 | CAAnimation *bounceOutRight = [animationManager backOutAnimationFor:dummyView withFade:NO direction:kFTAnimationRight 129 | duration:0.1f delegate:nil 130 | startSelector:nil stopSelector:nil]; 131 | [self verifyBounceAnimation:bounceOutRight uses:3 pathPoints:bounceOutRightPoints]; 132 | 133 | } 134 | 135 | - (void)testPopInAnimationBuilder { 136 | CAAnimationGroup *group = (CAAnimationGroup *)[[FTAnimationManager sharedManager] popInAnimationFor:dummyView 137 | duration:0.1f 138 | delegate:nil 139 | startSelector:nil 140 | stopSelector:nil]; 141 | CAKeyframeAnimation *keyframeAnimation = [[group animations] objectAtIndex:0]; 142 | NSArray *expectedScales = [NSArray arrayWithObjects:[NSNumber numberWithFloat:.5f], 143 | [NSNumber numberWithFloat:1.2f], 144 | [NSNumber numberWithFloat:.85f], 145 | [NSNumber numberWithFloat:1.f], nil]; 146 | STAssertEqualObjects(expectedScales, keyframeAnimation.values, nil); 147 | } 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /UnitTests-Info.plist: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 | 28 | CFBundleDevelopmentRegion 29 | English 30 | CFBundleExecutable 31 | ${EXECUTABLE_NAME} 32 | CFBundleIdentifier 33 | com.freetimestudios.FTUtils.${PRODUCT_NAME:identifier} 34 | CFBundleInfoDictionaryVersion 35 | 6.0 36 | CFBundlePackageType 37 | BNDL 38 | CFBundleSignature 39 | ???? 40 | CFBundleVersion 41 | 1.0 42 | 43 | 44 | -------------------------------------------------------------------------------- /UnitTests/UnitTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.freetimestudios.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /UnitTests/UnitTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'UnitTests' target in the 'UnitTests' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /UnitTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.1.0 2 | -------------------------------------------------------------------------------- /apidocs/.templates/docset/Contents/Resources/Documents/documents-template: -------------------------------------------------------------------------------- 1 | This is used only as placeholder for location of Documents directory! -------------------------------------------------------------------------------- /apidocs/.templates/docset/Contents/Resources/nodes-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{projectName}} 6 | {{indexFilename}} 7 | 8 | {{#hasClasses}} 9 | 10 | {{strings/docset/classesTitle}} 11 | {{indexFilename}} 12 | 13 | {{#classes}}{{>NodeRef}} 14 | {{/classes}} 15 | 16 | 17 | {{/hasClasses}} 18 | {{#hasCategories}} 19 | 20 | {{strings/docset/categoriesTitle}} 21 | {{indexFilename}} 22 | 23 | {{#categories}}{{>NodeRef}} 24 | {{/categories}} 25 | 26 | 27 | {{/hasCategories}} 28 | {{#hasProtocols}} 29 | 30 | {{strings/docset/protocolsTitle}} 31 | {{indexFilename}} 32 | 33 | {{#protocols}}{{>NodeRef}} 34 | {{/protocols}} 35 | 36 | 37 | {{/hasProtocols}} 38 | 39 | 40 | 41 | 42 | {{#classes}}{{>Node}} 43 | {{/classes}} 44 | {{#categories}}{{>Node}} 45 | {{/categories}} 46 | {{#protocols}}{{>Node}} 47 | {{/protocols}} 48 | 49 | 50 | 51 | Section Node 52 | 53 | {{name}} 54 | {{path}} 55 | 56 | EndSection 57 | 58 | Section NodeRef 59 | 60 | EndSection 61 | -------------------------------------------------------------------------------- /apidocs/.templates/docset/Contents/Resources/tokens-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{#object}} 5 | 6 | {{>TokenIdentifier}} 7 | {{>Abstract}} 8 | {{>DeclaredIn}} 9 | {{>RelatedTokens}} 10 | {{#refid}}{{/refid}} 11 | 12 | {{/object}} 13 | {{#members}} 14 | 15 | {{>TokenIdentifier}} 16 | {{>Abstract}} 17 | {{>DeclaredIn}} 18 | {{>RelatedTokens}} 19 | {{>MethodDeclaration}} 20 | {{#hasParameters}} 21 | {{#parameters}} 22 | {{name}} 23 | {{>Abstract}} 24 | {{/parameters}} 25 | {{/hasParameters}} 26 | {{#returnValue}}{{>Abstract}}{{/returnValue}} 27 | {{#anchor}}{{anchor}}{{/anchor}} 28 | 29 | {{/members}} 30 | 31 | 32 | 33 | Section TokenIdentifier 34 | {{identifier}} 35 | EndSection 36 | 37 | Section DeclaredIn 38 | {{declaredin}} 39 | EndSection 40 | 41 | Section RelatedTokens 42 | {{#hasRelatedTokens}} 43 | 44 | {{#relatedTokens}}{{.}} 45 | {{/relatedTokens}} 46 | 47 | {{/hasRelatedTokens}} 48 | EndSection 49 | 50 | Section Abstract 51 | {{#abstract}}{{>GBCommentComponentsList}}{{/abstract}} 52 | EndSection 53 | 54 | Section MethodDeclaration 55 | {{#formattedComponents}}{{value}}{{/formattedComponents}} 56 | EndSection 57 | 58 | Section GBCommentComponentsList 59 | {{#components}}{{&textValue}}{{/components}} 60 | EndSection 61 | 62 | -------------------------------------------------------------------------------- /apidocs/.templates/docset/Contents/info-template.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | {{#bundleIdentifier}}CFBundleIdentifier 8 | {{bundleIdentifier}}{{/bundleIdentifier}} 9 | {{#bundleName}}CFBundleName 10 | {{bundleName}}{{/bundleName}} 11 | {{#bundleVersion}}CFBundleShortVersionString 12 | {{bundleVersion}} 13 | CFBundleVersion 14 | {{bundleVersion}}{{/bundleVersion}} 15 | {{#certificateIssuer}}DocSetCertificateIssuer 16 | {{certificateIssuer}}{{/certificateIssuer}} 17 | {{#certificateSigner}}DocSetCertificateSigner 18 | {{certificateSigner}}{{/certificateSigner}} 19 | {{#description}}DocSetDescription 20 | {{description}}{{/description}} 21 | {{#fallbackURL}}DocSetFallbackURL 22 | {{fallbackURL}}{{/fallbackURL}} 23 | {{#feedName}}DocSetFeedName 24 | {{feedName}}{{/feedName}} 25 | {{#feedURL}}DocSetFeedURL 26 | {{feedURL}}{{/feedURL}} 27 | {{#minimumXcodeVersion}}DocSetMinimumXcodeVersion 28 | {{minimumXcodeVersion}}{{/minimumXcodeVersion}} 29 | {{#platformFamily}}DocSetPlatformFamily 30 | {{platformFamily}}{{/platformFamily}} 31 | {{#publisherIdentifier}}DocSetPublisherIdentifier 32 | {{publisherIdentifier}}{{/publisherIdentifier}} 33 | {{#publisherName}}DocSetPublisherName 34 | {{publisherName}}{{/publisherName}} 35 | {{#copyrightMessage}}NSHumanReadableCopyright 36 | {{copyrightMessage}}{{/copyrightMessage}} 37 | 38 | 39 | -------------------------------------------------------------------------------- /apidocs/.templates/html/css/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 3 | font-size: 13px; 4 | color: #000; 5 | } 6 | 7 | code { 8 | font-family: Courier, Consolas, monospace; 9 | font-size: 13px; 10 | color: #666; 11 | } 12 | 13 | pre { 14 | font-family: Courier, Consolas, monospace; 15 | font-size: 13px; 16 | line-height: 18px; 17 | tab-interval: 0.5em; 18 | border: 1px solid #C7CFD5; 19 | background-color: #F1F5F9; 20 | color: #666; 21 | padding: 0.3em 1em; 22 | } 23 | 24 | ul { 25 | list-style-type: square; 26 | } 27 | 28 | li { 29 | margin-bottom: 10px; 30 | } 31 | 32 | p:first-child { 33 | margin-top: 0.5em; 34 | } 35 | 36 | a code, 37 | a { 38 | text-decoration: none; 39 | color: #36C; 40 | } 41 | 42 | a:hover code, 43 | a:hover { 44 | text-decoration: underline; 45 | color: #36C; 46 | } 47 | 48 | /* @group Common page elements */ 49 | 50 | #top_header { 51 | height: 55px; 52 | left: 0; 53 | min-width: 598px; 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | z-index: 900; 58 | } 59 | 60 | #footer { 61 | clear: both; 62 | padding-top: 20px; 63 | text-align: center; 64 | } 65 | 66 | #contents { 67 | border-top: 1px solid #2B334F; 68 | position: absolute; 69 | top: 56px; 70 | left: 0; 71 | right: 0; 72 | bottom: 0; 73 | overflow-x: hidden; 74 | overflow-y: auto; 75 | padding-left: 2em; 76 | padding-right: 2em; 77 | padding-top: 1em; 78 | min-width: 550px; 79 | } 80 | 81 | #contents.isShowingTOC { 82 | left: 230px; 83 | min-width: 320px; 84 | } 85 | 86 | #overview_contents { 87 | padding-left: 2em; 88 | padding-right: 2em; 89 | padding-top: 1em; 90 | min-width: 550px; 91 | } 92 | 93 | .copyright { 94 | font-size: 12px; 95 | } 96 | 97 | .generator { 98 | font-size: 11px; 99 | } 100 | 101 | .main-navigation ul li { 102 | display: inline; 103 | margin-left: 15px; 104 | list-style: none; 105 | } 106 | 107 | .navigation-top { 108 | clear: both; 109 | float: right; 110 | } 111 | 112 | .navigation-bottom { 113 | clear: both; 114 | float: right; 115 | margin-top: 20px; 116 | margin-bottom: -10px; 117 | } 118 | 119 | .open > .disclosure { 120 | background-image: url("../img/disclosure_open.png"); 121 | } 122 | 123 | .disclosure { 124 | background: url("../img/disclosure.png") no-repeat scroll 0 0; 125 | } 126 | 127 | .disclosure, .nodisclosure { 128 | display: inline-block; 129 | height: 8px; 130 | margin-right: 5px; 131 | position: relative; 132 | width: 9px; 133 | } 134 | 135 | /* @end */ 136 | 137 | /* @group Header */ 138 | 139 | #top_header #title { 140 | background: url("../img/title_background.png") repeat-x 0 0 #8A98A9; 141 | border-bottom: 1px solid #B6B6B6; 142 | height: 25px; 143 | overflow: hidden; 144 | } 145 | 146 | #top_header h1 { 147 | font-size: 115%; 148 | font-weight: normal; 149 | margin: 0; 150 | padding: 3px 0 2px; 151 | text-align: center; 152 | text-shadow: 0 1px 0 #D5D5D5; 153 | white-space: nowrap; 154 | } 155 | 156 | #headerButtons { 157 | background-color: #D8D8D8; 158 | background-image: url("../img/button_bar_background.png"); 159 | border-bottom: 1px solid #EDEDED; 160 | border-top: 1px solid #2B334F; 161 | font-size: 8pt; 162 | height: 28px; 163 | left: 0; 164 | list-style: none outside none; 165 | margin: 0; 166 | overflow: hidden; 167 | padding: 0; 168 | position: absolute; 169 | right: 0; 170 | top: 26px; 171 | } 172 | 173 | #headerButtons li { 174 | background-repeat: no-repeat; 175 | display: inline; 176 | margin-top: 0; 177 | margin-bottom: 0; 178 | padding: 0; 179 | } 180 | 181 | #toc_button button { 182 | border-color: #ACACAC; 183 | border-style: none solid none none; 184 | border-width: 0 1px 0 0; 185 | height: 28px; 186 | margin: 0; 187 | padding-left: 30px; 188 | text-align: left; 189 | width: 230px; 190 | } 191 | 192 | li#jumpto_button { 193 | left: 230px; 194 | margin-left: 0; 195 | position: absolute; 196 | } 197 | 198 | li#jumpto_button select { 199 | height: 22px; 200 | margin: 5px 2px 0 10px; 201 | max-width: 300px; 202 | } 203 | 204 | /* @end */ 205 | 206 | /* @group Table of contents */ 207 | 208 | #tocContainer.isShowingTOC { 209 | border-right: 1px solid #ACACAC; 210 | display: block; 211 | overflow-x: hidden; 212 | overflow-y: auto; 213 | padding: 0; 214 | } 215 | 216 | #tocContainer { 217 | background-color: #E4EBF7; 218 | border-top: 1px solid #2B334F; 219 | bottom: 0; 220 | display: none; 221 | left: 0; 222 | overflow: hidden; 223 | position: absolute; 224 | top: 56px; 225 | width: 229px; 226 | } 227 | 228 | #tocContainer > ul#toc { 229 | font-size: 11px; 230 | margin: 0; 231 | padding: 12px 0 18px; 232 | width: 209px; 233 | -moz-user-select: none; 234 | -webkit-user-select: none; 235 | user-select: none; 236 | } 237 | 238 | #tocContainer > ul#toc > li { 239 | margin: 0; 240 | padding: 0 0 7px 30px; 241 | text-indent: -15px; 242 | } 243 | 244 | #tocContainer > ul#toc > li > .sectionName a { 245 | color: #000000; 246 | font-weight: bold; 247 | } 248 | 249 | #tocContainer > ul#toc > li > .sectionName a:hover { 250 | text-decoration: none; 251 | } 252 | 253 | #tocContainer > ul#toc li.children > ul { 254 | display: none; 255 | height: 0; 256 | } 257 | 258 | #tocContainer > ul#toc > li > ul { 259 | margin: 0; 260 | padding: 0; 261 | } 262 | 263 | #tocContainer > ul#toc > li > ul, ul#toc > li > ul > li { 264 | margin-left: 0; 265 | margin-bottom: 0; 266 | padding-left: 15px; 267 | } 268 | 269 | #tocContainer > ul#toc > li ul { 270 | list-style: none; 271 | margin-right: 0; 272 | padding-right: 0; 273 | } 274 | 275 | #tocContainer > ul#toc li.children.open > ul { 276 | display: block; 277 | height: auto; 278 | margin-left: -15px; 279 | padding-left: 0; 280 | } 281 | 282 | #tocContainer > ul#toc > li > ul, ul#toc > li > ul > li { 283 | margin-left: 0; 284 | padding-left: 15px; 285 | } 286 | 287 | #tocContainer li ul li { 288 | margin-top: 0.583em; 289 | overflow: hidden; 290 | text-overflow: ellipsis; 291 | white-space: nowrap; 292 | } 293 | 294 | #tocContainer li ul li span.sectionName { 295 | white-space: normal; 296 | } 297 | 298 | #tocContainer > ul#toc > li > ul > li > .sectionName a { 299 | font-weight: bold; 300 | } 301 | 302 | #tocContainer > ul#toc > li > ul a { 303 | color: #4F4F4F; 304 | } 305 | 306 | /* @end */ 307 | 308 | /* @group Index formatting */ 309 | 310 | .index-title { 311 | font-size: 13px; 312 | font-weight: normal; 313 | } 314 | 315 | .index-column { 316 | float: left; 317 | width: 30%; 318 | min-width: 200px; 319 | font-size: 11px; 320 | } 321 | 322 | .index-column ul { 323 | margin: 8px 0 0 0; 324 | padding: 0; 325 | list-style: none; 326 | } 327 | 328 | .index-column ul li { 329 | margin: 0 0 3px 0; 330 | padding: 0; 331 | } 332 | 333 | .hierarchy-column { 334 | min-width: 400px; 335 | } 336 | 337 | .hierarchy-column ul { 338 | margin: 3px 0 0 15px; 339 | } 340 | 341 | .hierarchy-column ul li { 342 | list-style-type: square; 343 | } 344 | 345 | /* @end */ 346 | 347 | /* @group Common formatting elements */ 348 | 349 | .title { 350 | font-weight: normal; 351 | font-size: 250%; 352 | margin-top:0; 353 | } 354 | 355 | .subtitle { 356 | font-weight: normal; 357 | font-size: 180%; 358 | color: #3C4C6C; 359 | border-bottom: 1px solid #5088C5; 360 | } 361 | 362 | .subsubtitle { 363 | font-weight: normal; 364 | font-size: 145%; 365 | height: 0.7em; 366 | } 367 | 368 | .warning { 369 | border: 1px solid #5088C5; 370 | background-color: #F0F3F7; 371 | margin-bottom: 0.5em; 372 | padding: 0em 0.8em; 373 | } 374 | 375 | .bug { 376 | border: 1px solid #000; 377 | background-color: #ffffcc; 378 | margin-bottom: 0.5em; 379 | padding: 0em 0.8em; 380 | } 381 | 382 | /* @end */ 383 | 384 | /* @group Common layout */ 385 | 386 | .section { 387 | margin-top: 3em; 388 | } 389 | 390 | /* @end */ 391 | 392 | /* @group Object specification section */ 393 | 394 | .section-specification { 395 | margin-left: 2.5em; 396 | margin-right: 2.5em; 397 | font-size: 12px; 398 | } 399 | 400 | .section-specification table { 401 | border-top: 1px solid #d6e0e5; 402 | } 403 | 404 | .section-specification td { 405 | vertical-align: top; 406 | border-bottom: 1px solid #d6e0e5; 407 | padding: .6em; 408 | } 409 | 410 | .section-specification .specification-title { 411 | font-weight: bold; 412 | } 413 | 414 | /* @end */ 415 | 416 | /* @group Tasks section */ 417 | 418 | .task-list { 419 | list-style-type: none; 420 | padding-left: 0px; 421 | } 422 | 423 | .task-list li { 424 | margin-bottom: 3px; 425 | } 426 | 427 | .task-item-suffix { 428 | color: #996; 429 | font-size: 12px; 430 | font-style: italic; 431 | margin-left: 0.5em; 432 | } 433 | 434 | span.tooltip span.tooltip { 435 | font-size: 1.0em; 436 | display: none; 437 | padding: 0.2em 0.3em; 438 | border: 1px solid #aaa; 439 | background-color: #fdfec8; 440 | color: #000; 441 | text-align: left; 442 | } 443 | 444 | span.tooltip span.tooltip p { 445 | margin: 0.1em 0.3em; 446 | } 447 | 448 | span.tooltip:hover span.tooltip { 449 | display: block; 450 | position: absolute; 451 | margin-left: 2em; 452 | } 453 | 454 | /* @end */ 455 | 456 | /* @group Method section */ 457 | 458 | .section-method { 459 | margin-top: 2.3em; 460 | } 461 | 462 | .method-title { 463 | margin-bottom: 1.5em; 464 | } 465 | 466 | .method-subtitle { 467 | margin-top: 0.7em; 468 | margin-bottom: 0.2em; 469 | } 470 | 471 | .method-subsection p { 472 | margin-top: 0.4em; 473 | margin-bottom: 0.8em; 474 | } 475 | 476 | .method-declaration { 477 | margin-top:1.182em; 478 | margin-bottom:.909em; 479 | } 480 | 481 | .method-declaration code { 482 | font:14px Courier, Consolas, monospace; 483 | color:#000; 484 | } 485 | 486 | .declaration { 487 | color: #000; 488 | } 489 | 490 | .argument-def { 491 | margin-top: 0.3em; 492 | margin-bottom: 0.3em; 493 | } 494 | 495 | .argument-def dd { 496 | margin-left: 1.25em; 497 | } 498 | 499 | .see-also-section ul { 500 | list-style-type: none; 501 | padding-left: 0px; 502 | margin-top: 0; 503 | } 504 | 505 | .see-also-section li { 506 | margin-bottom: 3px; 507 | } 508 | 509 | .see-also-section p { 510 | margin-top: 0; 511 | margin-bottom: 0; 512 | } 513 | 514 | .declared-in-ref { 515 | color: #666; 516 | } 517 | 518 | /* @end */ 519 | 520 | -------------------------------------------------------------------------------- /apidocs/.templates/html/document-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{page/title}} 5 | 6 | 7 | 8 | 9 | {{#strings/appledocData}}{{/strings/appledocData}} 10 | 11 | 12 |
13 | 14 |
15 | {{#object/comment}}{{#longDescription}}{{>GBCommentComponentsList}}{{/longDescription}}{{/object/comment}} 16 |
17 |
18 | 19 | 20 | 21 | 22 | Section GBCommentComponentsList 23 | {{#components}}{{>GBCommentComponent}}{{/components}} 24 | EndSection 25 | 26 | Section GBCommentComponent 27 | {{&htmlValue}} 28 | EndSection 29 | -------------------------------------------------------------------------------- /apidocs/.templates/html/hierarchy-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{page/title}} 5 | 6 | 7 | {{#strings/appledocData}}{{/strings/appledocData}} 8 | 9 | 10 |
11 |
12 | 15 | 20 |
21 | {{#hasClasses}} 22 |
23 |

{{strings/hierarchyPage/classesTitle}}

24 | {{>Classes}} 25 |
26 | {{/hasClasses}} 27 | 28 | {{#hasProtocolsOrCategories}} 29 |
30 | {{#hasProtocols}} 31 |

{{strings/hierarchyPage/protocolsTitle}}

32 |
    33 | {{#protocols}} 34 |
  • {{title}}
  • 35 | {{/protocols}} 36 |
37 | {{/hasProtocols}} 38 | {{#hasCategories}} 39 |

{{strings/hierarchyPage/categoriesTitle}}

40 |
    41 | {{#categories}} 42 |
  • {{title}}
  • 43 | {{/categories}} 44 |
45 | {{/hasCategories}} 46 |
47 | {{/hasProtocolsOrCategories}} 48 |
49 | 52 | 62 |
63 |
64 | 65 | 66 | 67 | Section Classes 68 | {{#hasClasses}} 69 | 74 | {{/hasClasses}} 75 | EndSection 76 | 77 | Section Navigation 78 | Previous 79 | EndSection -------------------------------------------------------------------------------- /apidocs/.templates/html/img/button_bar_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/apidocs/.templates/html/img/button_bar_background.png -------------------------------------------------------------------------------- /apidocs/.templates/html/img/disclosure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/apidocs/.templates/html/img/disclosure.png -------------------------------------------------------------------------------- /apidocs/.templates/html/img/disclosure_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/apidocs/.templates/html/img/disclosure_open.png -------------------------------------------------------------------------------- /apidocs/.templates/html/img/title_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/ftutils/481fe1214de37e5b69f9bc0fad8ee6a1850775e4/apidocs/.templates/html/img/title_background.png -------------------------------------------------------------------------------- /apidocs/.templates/html/index-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{page/title}} 5 | 6 | 7 | {{#strings/appledocData}}{{/strings/appledocData}} 8 | 9 | 10 |
11 |
12 | 15 | 20 |
21 | {{#hasClasses}} 22 |
23 |

{{strings/indexPage/classesTitle}}

24 |
    25 | {{#classes}} 26 |
  • {{title}}
  • 27 | {{/classes}} 28 |
29 |
30 | {{/hasClasses}} 31 | 32 | {{#hasProtocolsOrCategories}} 33 |
34 | {{#hasProtocols}} 35 |

{{strings/indexPage/protocolsTitle}}

36 |
    37 | {{#protocols}} 38 |
  • {{title}}
  • 39 | {{/protocols}} 40 |
41 | {{/hasProtocols}} 42 | {{#hasCategories}} 43 |

{{strings/indexPage/categoriesTitle}}

44 |
    45 | {{#categories}} 46 |
  • {{title}}
  • 47 | {{/categories}} 48 |
49 | {{/hasCategories}} 50 |
51 | {{/hasProtocolsOrCategories}} 52 |
53 | 56 | 66 |
67 |
68 | 69 | 70 | 71 | Section Navigation 72 | Next 73 | EndSection -------------------------------------------------------------------------------- /apidocs/.templates/html/object-template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{page/title}} 5 | 6 | 7 | 8 | 9 | {{#strings/appledocData}}{{/strings/appledocData}} 10 | 11 | 12 |
13 | 16 | 24 |
25 | 30 |
31 |
32 | 33 | 36 | 41 |
42 | {{#page/specifications}} 43 | {{#used}}
{{/used}} 44 | {{#values}}{{>ObjectSpecification}}{{/values}} 45 | {{#used}}
{{/used}} 46 | {{/page/specifications}} 47 | 48 | {{#object/comment}} 49 | {{#hasLongDescription}} 50 |
51 | 52 |

{{strings/objectOverview/title}}

53 | {{#longDescription}}{{>GBCommentComponentsList}}{{/longDescription}} 54 |
55 | {{/hasLongDescription}} 56 | {{/object/comment}} 57 | 58 | {{#object/methods}} 59 | {{#hasSections}} 60 |
61 | 62 |

{{strings/objectTasks/title}}

63 | {{#sections}} 64 | 65 | {{#sectionName}}{{/sectionName}} 66 | {{>TaskTitle}} 67 |
    68 | {{#methods}}{{>TaskMethod}}{{/methods}} 69 |
70 | {{/sections}} 71 |
72 | {{/hasSections}} 73 | {{/object/methods}} 74 | 75 | {{#object/methods}} 76 | {{#hasProperties}} 77 |
78 | 79 |

{{strings/objectMethods/propertiesTitle}}

80 | {{#properties}} 81 | {{>Method}} 82 | {{/properties}} 83 |
84 | {{/hasProperties}} 85 | 86 | {{#hasClassMethods}} 87 |
88 | 89 |

{{strings/objectMethods/classMethodsTitle}}

90 | {{#classMethods}} 91 | {{>Method}} 92 | {{/classMethods}} 93 |
94 | {{/hasClassMethods}} 95 | 96 | {{#hasInstanceMethods}} 97 |
98 | 99 |

{{strings/objectMethods/instanceMethodsTitle}}

100 | {{#instanceMethods}} 101 | {{>Method}} 102 | {{/instanceMethods}} 103 |
104 | {{/hasInstanceMethods}} 105 | {{/object/methods}} 106 |
107 | 110 | 119 |
120 |
121 | 204 | 205 | 206 | 207 | 208 | Section Method 209 |
210 | 211 |

{{methodSelector}}

212 | 213 | {{#comment}} 214 | {{#hasShortDescription}} 215 |
216 | {{#shortDescription}}{{>GBCommentComponent}}{{/shortDescription}} 217 |
218 | {{/hasShortDescription}} 219 | 220 |
{{>MethodDeclaration}}
221 | 222 | {{#hasMethodParameters}} 223 |
224 |

{{strings/objectMethods/parametersTitle}}

225 | {{#methodParameters}} 226 |
227 |
{{argumentName}}
228 |
{{#argumentDescription}}{{>GBCommentComponentsList}}{{/argumentDescription}}
229 |
230 | {{/methodParameters}} 231 |
232 | {{/hasMethodParameters}} 233 | 234 | {{#hasMethodResult}} 235 |
236 |

{{strings/objectMethods/resultTitle}}

237 | {{#methodResult}}{{>GBCommentComponentsList}}{{/methodResult}} 238 |
239 | {{/hasMethodResult}} 240 | 241 | {{#hasLongDescription}} 242 |
243 |

{{strings/objectMethods/discussionTitle}}

244 | {{#longDescription}}{{>GBCommentComponentsList}}{{/longDescription}} 245 |
246 | {{/hasLongDescription}} 247 | 248 | {{#hasMethodExceptions}} 249 |
250 |

{{strings/objectMethods/exceptionsTitle}}

251 | {{#methodExceptions}} 252 |
253 |
{{argumentName}}
254 |
{{#argumentDescription}}{{>GBCommentComponentsList}}{{/argumentDescription}}
255 |
256 | {{/methodExceptions}} 257 |
258 | {{/hasMethodExceptions}} 259 | 260 | {{#hasRelatedItems}} 261 |
262 |

{{strings/objectMethods/seeAlsoTitle}}

263 |
    264 | {{#relatedItems/components}} 265 |
  • {{>GBCommentComponent}}
  • 266 | {{/relatedItems/components}} 267 |
268 |
269 | {{/hasRelatedItems}} 270 | 271 | {{#prefferedSourceInfo}} 272 |
273 |

{{strings/objectMethods/declaredInTitle}}

274 | {{filename}}
275 |
276 | {{/prefferedSourceInfo}} 277 | {{/comment}} 278 |
279 | EndSection 280 | 281 | Section MethodDeclaration 282 | {{#formattedComponents}}{{#emphasized}}{{/emphasized}}{{#href}}{{/href}}{{value}}{{#href}}{{/href}}{{#emphasized}}{{/emphasized}}{{/formattedComponents}} 283 | EndSection 284 | 285 | 286 | Section TaskTitle 287 | {{#hasMultipleSections}}

{{#sectionName}}{{.}}{{/sectionName}}{{^sectionName}}{{strings/objectTasks/otherMethodsSectionName}}{{/sectionName}}

{{/hasMultipleSections}} 288 | {{^hasMultipleSections}}{{#sectionName}}

{{.}}

{{/sectionName}}{{/hasMultipleSections}} 289 | EndSection 290 | 291 | Section TaskMethod 292 |
  • 293 | 294 | {{>TaskSelector}} 295 | {{#comment}}{{#hasShortDescription}}{{#shortDescription}}{{>GBCommentComponent}}{{/shortDescription}}{{/hasShortDescription}}{{/comment}} 296 | 297 | {{#isProperty}}{{strings/objectTasks/property}}{{/isProperty}} 298 | {{#isRequired}}{{strings/objectTasks/requiredMethod}}{{/isRequired}} 299 |
  • 300 | EndSection 301 | 302 | Section TaskSelector 303 | {{#isInstanceMethod}}– {{/isInstanceMethod}}{{#isClassMethod}}+ {{/isClassMethod}}{{#isProperty}}  {{/isProperty}}{{methodSelector}} 304 | EndSection 305 | 306 | 307 | Section GBCommentComponentsList 308 | {{#components}}{{>GBCommentComponent}}{{/components}} 309 | EndSection 310 | 311 | Section GBCommentComponent 312 | {{&htmlValue}} 313 | EndSection 314 | 315 | Section ObjectSpecification 316 | 317 | {{title}} 318 | {{#values}}{{#href}}{{/href}}{{string}}{{#href}}{{/href}}{{&delimiter}}{{/values}} 319 | 320 | EndSection 321 | 322 | 323 | Section Navigation 324 | 328 | EndSection 329 | 330 | Section JumpTo 331 | 366 | EndSection 367 | 368 | Section TableOfContents 369 | {{#object/comment}} 370 |
  • {{strings/objectOverview/title}}
  • 371 | {{/object/comment}} 372 | 373 | {{#object/methods}} 374 | {{#hasSections}} 375 |
  • {{strings/objectTasks/title}}
  • 380 | {{/hasSections}} 381 | {{/object/methods}} 382 | 383 | {{#object/methods}} 384 | {{#hasProperties}} 385 |
  • {{strings/objectMethods/propertiesTitle}}
  • 390 | {{/hasProperties}} 391 | 392 | {{#hasClassMethods}} 393 |
  • {{strings/objectMethods/classMethodsTitle}}
  • 398 | {{/hasClassMethods}} 399 | 400 | {{#hasInstanceMethods}} 401 |
  • {{strings/objectMethods/instanceMethodsTitle}}
  • 406 | {{/hasInstanceMethods}} 407 | {{/object/methods}} 408 | EndSection --------------------------------------------------------------------------------