我有两个视图控制器。我创建了一个自定义segue,从第一个viewcontroller到第二个,反之亦然,将两个segue链接到下面的类:(我从互联网教程下载了这个类)
#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
(我刚刚改变了从#34;右" lo"左"取决于我是哪个视图控制器) 我通过轻扫手势调用segue。
它按预期工作,但有时,随机,当我轻扫以调用segue时,它会崩溃。 这是出现的错误。
pru(745,0x1ae6d5c40) malloc: *** error for object 0x170014930: Invalid pointer dequeued from free list
*** set a breakpoint in malloc_error_break to debug
(lldb)
我该如何解决这个问题?
答案 0 :(得分:-1)
像这样创建UIviewController obj
SomeViewController * someViewController = [self.storyboard instantiateViewControllerWithIdentifier:@“SomeViewController”];