Skip to content

Instantly share code, notes, and snippets.

@AlexanderBollbach
Created August 24, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexanderBollbach/3e3ddba9cca9eca001fc to your computer and use it in GitHub Desktop.
Save AlexanderBollbach/3e3ddba9cca9eca001fc to your computer and use it in GitHub Desktop.
#import "OrbitViewController.h"
#import <stdio.h>
#import <math.h>
@interface OrbitViewController()
@end
@implementation OrbitViewController
- (void) hideShowNavigation {
[self.navigationController setNavigationBarHidden:!self.navigationController.navigationBarHidden];
}
-(void)updateCADL{
[self.orbManager checkDistances];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
//NSLog(@"%@", touch.view);
if (![touch.view isEqual:self.view]) {
touch.view.center = touchLocation;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
self.orbManager = [OrbManager orbManager];
self.orb1 = [[OrbView alloc] initWithFrame:CGRectMake(0, 0, 50, 50) ofSuperView:self.view andName:@"orb1"];
self.orb2 = [[OrbView alloc] initWithFrame:CGRectMake(0, 580, 50, 50) ofSuperView:self.view andName:@"orb2"];
self.orb3 = [[OrbView alloc] initWithFrame:CGRectMake(25, 580, 50, 50) ofSuperView:self.view andName:@"orb3"];
self.orb4 = [[OrbView alloc] initWithFrame:CGRectMake(50, 580, 50, 50) ofSuperView:self.view andName:@"orb4"];
self.orb5 = [[OrbView alloc] initWithFrame:CGRectMake(75, 580, 50, 50) ofSuperView:self.view andName:@"orb5"];
self.orb6 = [[OrbView alloc] initWithFrame:CGRectMake(100, 580, 50, 50) ofSuperView:self.view andName:@"orb6"];
self.orbMaster = [OrbMaster orbMaster];
[self.view addSubview:self.orbMaster];
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(updateCADL)];
[displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
}
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES];
[super viewWillAppear:animated];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment