2012-12-18 2 views
3

"라이브러리"스타일의 UIViewController는 1.75 라디안 각도의 CATransform3D 회전 애니메이션을 수행하여 애니메이션이없는 다음 또는 마지막 뷰로 푸시하기 전에 숨 깁니다. 불행히도, UIViewController 팝업 애니메이션을 수행 할 때 팝업 된 VC 터치 감응하지 않습니다. 내가 시도CATransform3D 애니메이션 후 UIViewController가 응답하지 않음

것들 : -

  • 터지는보다는 전혀 애니메이션되지 가진 후 표시 할 애니메이션을 얻으려면, 나는 0.1 초를 지연해야합니다. 이렇게하려면 NSObject의 performSelector : withObject : afterDelay를 사용합니다. 불행히도, 완벽하게 의도 된 애니메이션을 수행하는 동안 내 이름 문제가 발생합니다.
  • NSTimer를 사용하여 0.1 초 후에 반복 작업을 수행합니다. 이것은 아무것도하지 않습니다.
  • 애니메이션 작업 중 UIView의 지연 기능을 사용하려면 애니메이션이 수행되지 않습니다.
  • 셀렉터를 사용하여 다른 사람이 참조하여 애니메이션을 수행하려면. 효과 없음.
  • 보기가 터치에 반응하지 않는 동안 touchesEnded를 호출하면 효과가 없습니다.

내 현재 코드, 조금 어수선한 (코어 애니메이션/QuartzCore의 첫 사용), 동안 ... 펑 경우

애니메이션을 수행합니다.

//To collect it in the SecondVC 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(coolAnimation) name:@"ReturnSecond" object:nil]; 
//To send it from the ThirdVC 
[[NSNotificationCenter defaultCenter] postNotificationName:@"ReturnSecond" object:nil]; 

가 회전 할 때까지 뷰 변환을 각도로 푸시하기 전에 1.75 라디안 회전 등 유지한다

- (void)coolAnimation 
{ 
    [self performSelector:@selector(tryThis) withObject:nil afterDelay:0.1]; 
} 

- (void)tryThis 
{ 
    CGRect framer = self.view.layer.frame; 
    self.view.layer.anchorPoint = CGPointMake(0.f, 0.f); 
    self.view.layer.frame = framer; 
    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:0.3]; 
    CATransform3D rotationAndPerspectiveTransforms = CATransform3DIdentity; 
    rotationAndPerspectiveTransforms.m34 = 1.0/500; 
    rotationAndPerspectiveTransforms = CATransform3DRotate(rotationAndPerspectiveTransforms, 0, 0, 1, 0); 
    self.view.layer.transform = rotationAndPerspectiveTransforms; 
    [UIView commitAnimations]; 

    CGRect framers = flippedCell.layer.frame; 
    flippedCell.layer.anchorPoint = CGPointMake(0.f, 0.f); 
    flippedCell.layer.frame = framers; 
    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:0.7]; 
    CATransform3D rotateTransform = CATransform3DIdentity; 
    rotateTransform.m34 = 1.0/500; 
    rotateTransform = CATransform3DRotate(rotateTransform, 0, 0, 1, 0); 
    flippedCell.layer.transform = rotateTransform; 
    [UIView commitAnimations]; 

    [self performSelector:@selector(cellAnimationDidStop) withObject:nil afterDelay:0.7]; 
} 

- (void)cellAnimationDidStop 
{ 
    [self.tableView reloadData]; 
} 

애니메이션에게 현재까지 VC

[[NSNotificationCenter defaultCenter] postNotificationName:@"ReturnWeird" object:nil]; 
NSUInteger integer = [[self.navigationController viewControllers] indexOfObject:self]; 
[[self navigationController] popToViewController:[[self.navigationController viewControllers] objectAtIndex:integer-1] animated:NO]; 

팝 뒤로.

내 코드에 대한 유용한 정보도 제공해 주시면 감사하겠습니다.

+0

들여 쓰기는 코드를 훨씬 쉽게 읽을 수있게 해줍니다. 코드를 읽기 쉽기 때문에 더 많은 사람들이 당신을 도우 려합니다. –

+0

글쎄 대단히 감사합니다. – Giz

답변

1

디버깅 3 일 후 답변을 찾았습니다. 밖으로 전락했다 나는 전체 ViewController를 새롭게하기 위하여 뒤에 오는 선을 이용하는 것이 최상이었다. 무거운 메모리이지만 거대한 버그가 수정되었습니다.

[self becomeFirstResponder]; 
관련 문제