전환 파일을 사용하여 페이지간에 넘겨주는 앱이 있습니다. 내가 ARC를 사용하고 5.1에서 정상적으로 작동하지만 4.3 시뮬레이터에서 항상 충돌합니다. 계측기에서 스레드와 확장 된 디테일을 살펴보면, EXC_BREAKPOINT (코드 = EXC_I386_BPT)와 함께 2 줄의 코드 (아래 그림 참조)를 가리 킵니다. 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