This file contains 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
- (void)dragged:(UIPanGestureRecognizer *)gestureRecognizer | |
{ | |
CGFloat xDistance = [gestureRecognizer translationInView:self].x; | |
CGFloat yDistance = [gestureRecognizer translationInView:self].y; | |
switch (gestureRecognizer.state) { | |
case UIGestureRecognizerStateBegan:{ | |
self.originalPoint = self.center; | |
break; | |
}; |
This file contains 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
- (id)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (!self) return nil; | |
self.panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(dragged:)]; | |
[self addGestureRecognizer:self.panGestureRecognizer]; | |
[self loadImageAndStyle]; |
This file contains 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 <Foundation/Foundation.h> | |
typedef NS_ENUM(NSUInteger , GGOverlayViewMode) { | |
GGOverlayViewModeLeft, | |
GGOverlayViewModeRight | |
}; | |
@interface GGOverlayView : UIView | |
@property (nonatomic) GGOverlayViewMode mode; | |
@end |
This file contains 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 "GGOverlayView.h" | |
@interface GGOverlayView () | |
@property (nonatomic, strong) UIImageView *imageView; | |
@end | |
@implementation GGOverlayView | |
- (id)initWithFrame:(CGRect)frame { | |
self = [super initWithFrame:frame]; |
This file contains 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
- (void)dragged:(UIPanGestureRecognizer *)gestureRecognizer | |
{ | |
CGFloat xDistance = [gestureRecognizer translationInView:self].x; | |
CGFloat yDistance = [gestureRecognizer translationInView:self].y; | |
switch (gestureRecognizer.state) { | |
case UIGestureRecognizerStateBegan:{ | |
self.originalPoint = self.center; | |
break; | |
}; |
This file contains 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 | |
{ |
This file contains 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 "GGView.h" | |
#import "GGDraggableView.h" | |
@interface GGView () | |
@property (nonatomic, strong) GGDraggableView *draggableView; | |
@end | |
@implementation GGView | |
- (id)init |
This file contains 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
- (void)loadViewController:(UIViewController *)vc | |
fromLeft:(BOOL)fromLeft | |
{ | |
[self addChildViewController:vc]; | |
if (!self.currentVC) { | |
[self.view addSubview:vc.view]; | |
vc.view.frame = self.view.bounds; | |
self.currentVC = vc; | |
return; | |
} |
This file contains 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
- (void)tabTapped | |
{ | |
if ([self.currentVC isKindOfClass:[GGViewController1 class]]) { | |
[self loadViewController:[[GGViewController2 alloc] init]]; | |
} else { | |
[self loadViewController:[[GGViewController1 alloc] init]]; | |
} | |
} |
This file contains 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 "GGViewController1.h" | |
@interface GGViewController1 () | |
@end | |
@implementation GGViewController1 | |
- (void)viewDidLoad | |
{ |
NewerOlder