Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 65 lines (52 sloc) 2.27 kb
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
1 //
2 // UIView+GMGridViewShake.m
3 // GMGridView
4 //
5 // Created by Gulam Moledina on 11-10-22.
6 // Copyright (c) 2011 GMoledina.ca. All rights reserved.
7 //
4cf9e41 @gmoledina Minor changes and cleanup
authored
8 // Latest code can be found on GitHub: https://github.com/gmoledina/GMGridView
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
11 // of this software and associated documentation files (the "Software"), to deal
12 // in the Software without restriction, including without limitation the rights
13 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 // copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included in
18 // all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 // THE SOFTWARE.
27 //
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
28
900c5d7 @dennda fix compilation. Was broken due to incorrect header import. It's QuartzC...
dennda authored
29 #import <QuartzCore/QuartzCore.h>
78672a0 @gmoledina Added strategy classes for the layouting of subviews + minor improvement...
authored
30 #import "UIView+GMGridViewAdditions.h"
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
31
78672a0 @gmoledina Added strategy classes for the layouting of subviews + minor improvement...
authored
32 @interface UIView (GMGridViewAdditions_Privates)
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
33
34
35 @end
36
37
38
39
78672a0 @gmoledina Added strategy classes for the layouting of subviews + minor improvement...
authored
40 @implementation UIView (GMGridViewAdditions)
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
41
42 - (void)shakeStatus:(BOOL)enabled
43 {
44 if (enabled)
45 {
0aebad8 @gmoledina Shaking animation when in edit mode
authored
46 CGFloat rotation = 0.03;
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
47
0aebad8 @gmoledina Shaking animation when in edit mode
authored
48 CABasicAnimation *shake = [CABasicAnimation animationWithKeyPath:@"transform"];
49 shake.duration = 0.13;
50 shake.autoreverses = YES;
51 shake.repeatCount = MAXFLOAT;
3cd7d02 @gmoledina Minor edit on shaking animation to make it continue even when switching ...
authored
52 shake.removedOnCompletion = NO;
0aebad8 @gmoledina Shaking animation when in edit mode
authored
53 shake.fromValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform,-rotation, 0.0 ,0.0 ,1.0)];
54 shake.toValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform, rotation, 0.0 ,0.0 ,1.0)];
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
55
0aebad8 @gmoledina Shaking animation when in edit mode
authored
56 [self.layer addAnimation:shake forKey:@"shakeAnimation"];
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
57 }
58 else
59 {
0aebad8 @gmoledina Shaking animation when in edit mode
authored
60 [self.layer removeAnimationForKey:@"shakeAnimation"];
bc02152 @gmoledina No more data structure in view, added support for more gestures
authored
61 }
62 }
63
64 @end
Something went wrong with that request. Please try again.