我加载了一个xib,然后我需要用一个按钮关闭它。我正在使用这个:
- (IBAction)donePressed:(id)sender {
printf("Done\n");
[self check_result];
printf("Removing View\n");
[self.view removeFromSuperview];
}
我像这样加载XIB:
AFUserFeedbackController *moviePlayer_af = [[AFUserFeedbackController alloc] initWithNibName:@"UserFeedback" bundle:nil];
UIWindow *backgroundWindow = [[UIApplication sharedApplication] keyWindow];
moviePlayer_af.view.frame = backgroundWindow.frame;
[backgroundWindow addSubview:moviePlayer_af.view];
这是我映射它的方式:
但是按下按钮后,我得到的是EXC_BAD_ACCESS
错误,我得到了这个输出:
(lldb)
和EXC_BAD_ACCESS
错误。我该如何解决这个问题?
答案 0 :(得分:0)
-(IBAction)donePressed:(id)sender
{
printf("Done\n");
printf("Removing View\n");
[moviePlayer_af.view removeFromSuperview];
}