我有一個使用的過渡文件從頁面翻轉到頁面的應用程序。我使用ARC並且在5.1上工作得很好,但是在4.3模擬器上一直崩潰。查看線程和儀器的擴展細節,它指向2行代碼(如下所示),並顯示錯誤:EXC_BREAKPOINT(code = EXC_I386_BPT)。看起來像UIViewController正在被釋放。不知道如何解決這個問題。預先感謝您提供的任何幫助!消息發送到的dealloc的UIViewController,錯誤:EXC_BREAKPOINT(代碼= EXC_I386_BPT)
@synthesize containerView = _containerView;
@synthesize viewController = _viewController; //ERROR LINE#1
- (id)initWithViewController:(UIViewController *)viewController
{
if (self = [super init])
{
_viewController = viewController;
}
return self;
}
- (void)loadView
{
self.wantsFullScreenLayout = YES;
UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
self.view = view;
_containerView = [[UIView alloc] initWithFrame:view.bounds];
_containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self.view addSubview:_containerView];
[_containerView addSubview:self.viewController.view];
}
- (void)transitionToViewController:(UIViewController *)aViewController
withOptions:(UIViewAnimationOptions)options
{
aViewController.view.frame = self.containerView.bounds;
[UIView transitionWithView:self.containerView
duration:0.65f
options:options
animations:^{ [self.viewController.view removeFromSuperview];
[self.containerView addSubview:aViewController.view];}
completion:^(BOOL finished)
//ERROR LINE#2 { self.viewController = aViewController;}];
}
你在哪裏打電話transitionToViewController? –
我爲每個頁面都有一個ViewController。這是我用來調用它的代碼行。 TitlePageViewController * tpvc = [[TitlePageViewController alloc] init]; AppDelegate * appDelegate = [UIApplication sharedApplication] .delegate; [appDelegate.transitionController transitionToViewController:TPVC withOptions:UIViewAnimationOptionTransitionCurlUp]; – ctw