簡體   English   中英

添加手勢識別器

[英]Add Gesture recognizer

我有兩個viewController:FirstViewController和SecondViewController

我制作了一個動畫,使視圖從右到左。

我想要在向右掃視SecondViewController時隱藏並顯示FirstViewController

動畫作品中有代碼

SecondViewController *secondViewController = [[SecondViewController alloc]      initWithNibName:@"PlayListController" bundle:nil];
// Set up view2
secondViewController.view.frame = self.view.frame;
secondViewController.view.center = CGPointMake(self.view.center.x +   CGRectGetWidth(self.view.frame), self.view.center.y);
[self.view.superview addSubview:secondViewController.view];
// Animate the push
[UIView beginAnimations: nil context: NULL];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: @selector(pushAnimationDidStop:finished:context:)];
secondViewController.view.center = self.view.center;
self.view.center = CGPointMake(self.view.center.x - CGRectGetWidth(self.view.frame), self.view.center.y);
[UIView commitAnimations];

我添加了一個按鈕來隱藏帶有動畫的視圖,但是它不起作用?

  1. 將手勢識別器添加到視圖中。
  2. 在回調中,彈出視圖控制器。

注意:這是非標准的UI。 最好使用標准導航欄和后退按鈕。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM