Last active
January 3, 2016 15:19
-
-
Save ngutman/8482226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "GGDraggableView.h" | |
@interface GGDraggableView () | |
@property (nonatomic, strong) UIPanGestureRecognizer *panGestureRecognizer; | |
@end | |
@implementation GGDraggableView | |
- (id)init | |
{ | |
self = [super init]; | |
if (!self) return nil; | |
self.backgroundColor = [UIColor greenColor]; | |
self.panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(dragged:)]; | |
[self addGestureRecognizer:self.panGestureRecognizer]; | |
[self loadImageAndStyle]; | |
return self; | |
} | |
- (void)loadImageAndStyle | |
{ | |
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bar"]]; | |
[self addSubview:imageView]; | |
self.layer.cornerRadius = 8; | |
self.layer.shadowOffset = CGSizeMake(7, 7); | |
self.layer.shadowRadius = 5; | |
self.layer.shadowOpacity = 0.5; | |
} | |
- (void)dragged:(UIGestureRecognizer *)gestureRecognizer | |
{ | |
// TODO: Write Logic | |
} | |
- (void)dealloc | |
{ | |
[self removeGestureRecognizer:self.panGestureRecognizer]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment