2013-02-14 5 views
0

두 개의 viewController가 있습니다. FirstViewController 및 SecondViewController제스처 인식기 추가

뷰를 오른쪽에서 왼쪽으로 만드는 애니메이션을 만듭니다. A는 FirstViewController

을 SecondViewController 숨기기를 잘하고 보여줄 수있는 스윕을 할 때

내가 원하는 내가 애니메이션보기를 숨길 수있는 버튼을 추가

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

왜 작동하는 코드를 제공했는데 어려움을 겪고있는 코드를 제공하지 않았습니까? –

+0

이 방법으로 전환하려는 시도는 문제가 있습니다 (보기 계층 구조가 컨트롤러 계층 구조와 일치하지 않아 특정 이벤트, 메모리 관리 문제 등을받지 못합니다). 네비게이션 컨트롤러를 사용해야하고, 네비게이션 바를보고 싶지 않다면 [숨기기] (http://developer.apple.com/library/ios/documentation/uikit/reference/UINavigationController_Class/Reference/ Reference.html # // apple_ref/doc/uid/TP40006934-CH3-SW9). 자신의 시도보다 훨씬 강력하게 구현 된 표준 동작을 복제하기 위해 많은 작업을 수행하고 있습니다. – Rob

답변

0
  1. 제스처 인식기를보기에 추가하십시오.
  2. 콜백에서보기 컨트롤러를 팝합니다.

경고 : 비표준 UI입니다. 표준 탐색 모음 및 뒤로 단추로 이동하십시오.