Skip to content

Instantly share code, notes, and snippets.

@truongvinht
truongvinht / panGesture.m
Created May 7, 2012 12:21 — forked from sebk/panGesture.m
Move component with UIPanGestureRecognizer
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"BUTTON" forState:UIControlStateNormal];
[button setFrame:CGRectMake(50, 50, 150, 150)];
[self.view addSubview:button];
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(invokePanGesture:)];