在我更新到 ios6 之前,我有一个完美的工作项目。
当我在一个栏项目上标签以显示一个带有视图的弹出窗口时,应用程序崩溃了......
这是我得到的错误
"reason: 'A view can only be associated with at most one view controller at a time! View <UIView: 0xaa7d730; frame = (20 0; 748 1024); autoresize = RM+BM; layer = <CALayer: 0xaa7d790>> is associated with <TYOFormViewController: 0xaa7d8b0>. Clear this association before associating this view with <TYOFormViewController: 0x14c68a70>.'"
这是声明 UIViewController 和 UIPopoverController 的方法。
- (IBAction)TestDriveTapped:(id)sender{
if (PopoverController != nil) {
[PopoverController dismissPopoverAnimated:YES];
self.PopoverController = nil;
}
if (self.PopoverController == nil) {
UIViewController *bookTestDrive =[[TYOFormViewController alloc] initWithNibName:@"TYOBookTestDriveForm" bundle:nil];
UIPopoverController *poc = [[UIPopoverController alloc]
initWithContentViewController:bookTestDrive];
[poc presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
self.PopoverController = poc;
} else {
if (PopoverController != nil) {
[PopoverController dismissPopoverAnimated:YES];
self.PopoverController = nil;
}
}
}
错误说我必须清除与 TYOFormViewController 的关联才能将其与 TYOFormViewController 关联....这是怎么发生的???
希望你能在这个问题上得到你的帮助......整天都被它困住了......
谢谢