0
두 개의 뷰 컨트롤러가 있습니다. 나는 두 번째와 viceversa에에 대한 첫 번째의 ViewController에서 사용자 정의 SEGUE을 만든 다음 클래스에 모두 segues를 연결 : (나는 인터넷 튜토리얼에서 클래스를 다운로드) (난 그냥 오른쪽 "에서 전환을 변경 다음 뷰 컨트롤러에 스 와이프 제스처가 발생했습니다.
#import "SlideLeftCustomSegue.h"
@implementation SlideLeftCustomSegue
- (void)perform{
UIViewController *srcViewController = (UIViewController *) self.sourceViewController;
UIViewController *destViewController = (UIViewController *) self.destinationViewController;
CATransition *transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[srcViewController.view.window.layer addAnimation:transition forKey:nil];
[srcViewController presentViewController:destViewController animated:NO completion:nil];
}
@end
"lo"왼쪽 "어떤 뷰 콘트롤러인지에 따라) 나는 스 와이프 제스처에서 세그를 호출한다.
예상대로 작동하지만 때로는 무작위로 내가 스쳐서 전화를 걸면 충돌합니다. 이것은 나타나는 오류입니다.
pru(745,0x1ae6d5c40) malloc: *** error for object 0x170014930: Invalid pointer dequeued from free list
*** set a breakpoint in malloc_error_break to debug
(lldb)
어떻게 해결할 수 있습니까?
스 와이프 방법으로 NSLog를 실행하고 일반적으로 발생할 수있는 두 번 내뿜는 지 확인하십시오. 질문에 스 와이프 메서드 코드를 포함시켜야합니다. 이 문제가 발생하면 BOOL 속성을 만들어야하며 스 와이프 애니메이션을 시작하기 전에 bool isAnimating = YES; isAnimation == NO 일 때만 애니메이션을 실행하는지 확인하십시오. 이 문제가 해결되면 여기에 답변을 추가 할 수 있도록 알려주십시오. –
답변 해 주셔서 감사합니다. 나는 네가 한 말을했으나 효과가 없었다. 다른 아이디어? 시간 내 주셔서 감사합니다. 고마워요! @ Snne – user1935016
더 이상 당신을 도울 수있는 "작동하지 않았다"보다 더 많은 세부 사항이 필요합니다. 스 와이프가 한 번만 호출되면 100 % 확신하고 테스트 했습니까? 그리고 한 번만 부르면 여전히 충돌이 있습니까? –