Created
April 18, 2010 16:36
-
-
Save SquaredTiki/370346 to your computer and use it in GitHub Desktop.
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)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"touchDown"); | |
UITouch *touch = [touches anyObject]; | |
firstTouch = [touch locationInView:self.view]; | |
} | |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSArray *array = [touches allObjects]; | |
UITouch *specificTouch = [array objectAtIndex:0]; | |
currentTouch = [specificTouch locationInView:self.view]; | |
if (CGRectContainsPoint(but.frame, firstTouch)) { | |
NSLog(@"touch in subView/contentView"); | |
but.frame = CGRectMake(currentTouch.x, currentTouch.y , 130.0, 21.0); | |
} | |
NSLog(@"touch moved"); | |
} | |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { | |
UITouch *touch = [touches anyObject]; | |
currentTouch = [touch locationInView:self.view]; | |
if (CGRectContainsPoint(but.frame, firstTouch)) { | |
NSLog(@"touch in subView/contentView"); | |
but.frame = CGRectMake(currentTouch.x, currentTouch.y, 130.0, 21.0); | |
} | |
NSLog(@"touch ended"); | |
} | |
- (IBAction)add:(id)sender{ | |
InSightViewController *contentView = [[InSightViewController alloc] initWithNibName:@"SubView" bundle:[NSBundle mainBundle]]; | |
[contentView loadView]; | |
[self.view addSubview:contentView.view]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment