Skip to content

Instantly share code, notes, and snippets.

@syamn
Created November 7, 2013 05:34
Show Gist options
  • Save syamn/7349532 to your computer and use it in GitHub Desktop.
Save syamn/7349532 to your computer and use it in GitHub Desktop.
"Objective-C iPhoneアプリ開発 入門ノート" ページ 230-231 さんぷる?
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *image;
- (IBAction)panning:(UIPanGestureRecognizer *)sender;
@end
@implementation ViewController
- (IBAction)panning:(UIPanGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateBegan){
_image.center = [sender locationInView:self.view];
}
CGPoint trans = [sender translationInView:self.view];
_image.transform = CGAffineTransformMakeTranslation(trans.x, trans.y);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment