Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. - (void)viewDidLoad
  2. {
  3. [super viewDidLoad];
  4. // Do any additional setup after loading the view.
  5. self.scrollView.delegate = self;
  6. self.scrollView.maximumZoomScale = 5.0f;
  7.  
  8. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
  9. tapGesture.delegate = self;
  10. tapGesture.numberOfTapsRequired = 1;
  11. tapGesture.numberOfTouchesRequired = 1;
  12. [self.scrollView addGestureRecognizer:tapGesture];
  13. }
  14.  
  15. #pragma mark - UIScrollView Delegate
  16.  
  17. - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
  18. {
  19. return self.imageView;
  20. }
  21.  
  22. #pragma mark - UIGestureRecognizer Delegate
  23.  
  24. - (void)handleTap:(UITapGestureRecognizer *)tapGestur
  25. {
  26. NSLog(@"%s", __PRETTY_FUNCTION__);
  27.  
  28. if (tapGestur.state == UIGestureRecognizerStateEnded) {
  29.  
  30. [UIView transitionWithView:self.imageView duration:1 options:UIViewAnimationOptionTransitionFlipFromRight|UIViewAnimationOptionCurveEaseInOut animations:^{
  31. if (!flipped) {
  32. self.imageView.image = [UIImage imageNamed:@"2-IPAD-P.jpg"];
  33. flipped = YES;
  34. }
  35. else {
  36. self.imageView.image = [UIImage imageNamed:@"1-IPAD-P.jpg"];
  37. }
  38. } completion:^(BOOL finished) {
  39. //
  40. }];
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement