Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How can I switch views vertically using swipe gestures ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
350 views
Welcome To Ask or Share your Answers For Others

1 Answer

I found my answer. I am posting the code for your reference. Thanks :-)

in viewDidLoad

  UISwipeGestureRecognizer *swipeGesture = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipedScreendown:)] autorelease];
  swipeGesture.numberOfTouchesRequired = 1;
  swipeGesture.direction = UISwipeGestureRecognizerDirectionDown;
  [m_pImageView addGestureRecognizer:swipeGesture];

Now

- (void)swipedScreendown:(UISwipeGestureRecognizer*) swipeGesture {
  m_pViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
  CATransition *transition = [CATransition animation];
  transition.duration = 0.75;
  transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
  transition.type = kCATransitionPush;
  transition.subtype = kCATransitionFromBottom;
  transition.delegate = self;
  [self.view.layer addAnimation:transition forKey:nil];
  [self.view addSubview:PadViewController.view];
}

If you need some more clarification please post here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...