Created
November 7, 2013 05:34
-
-
Save syamn/7349532 to your computer and use it in GitHub Desktop.
"Objective-C iPhoneアプリ開発 入門ノート" ページ 230-231 さんぷる?
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 "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