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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self loadTab]; | |
} | |
- (void)loadTab | |
{ | |
self.segmentControl = [[UISegmentedControl alloc] initWithItems:@[@"View Controller 1", | |
@"View Controller 2"]]; |
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 | |
{ |
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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self loadTab]; | |
[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
- (void)loadViewController:(UIViewController *)vc | |
{ | |
[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
- (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
#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
#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
- (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 "GGOverlayView.h" | |
@interface GGOverlayView () | |
@property (nonatomic, strong) UIImageView *imageView; | |
@end | |
@implementation GGOverlayView | |
- (id)initWithFrame:(CGRect)frame { | |
self = [super initWithFrame:frame]; |
OlderNewer