1

我有一个普通的 UIPopoverController ,它是这样制作的:

-(IBAction)btKBIs_click:(id)sender
{

if(kbiPopOver != NULL)
    [kbiPopOver dismissPopoverAnimated:YES];

KBIViewController *kbiViewController = [[KBIViewController alloc]initWithNibName:@"KBIViewController" bundle:nil CurrentUser:currentUser];
kbiViewController.currentStatus = FIRST;
kbiViewController.firstlist = [currentUser getDescriptions];
kbiViewController.mapViewController =self;


UINavigationController* kbiNavController = [[UINavigationController alloc] initWithRootViewController:kbiViewController];

kbiPopOver = [[UIPopoverController alloc] initWithContentViewController:kbiNavController];
kbiPopOver.delegate = self;

kbiViewController.kbiPopOver = kbiPopOver;

[kbiPopOver presentPopoverFromBarButtonItem:sender 
                     permittedArrowDirections:UIPopoverArrowDirectionUp animated:true];

}

在我正在调用的类 KBIViewController 中:

    [self.kbiPopOver dismissPopoverAnimated:YES];
    [self.kbiPopOver.delegate popoverControllerDidDismissPopover:self.kbiPopOver];

解雇它,但它不起作用。为什么?

4

1 回答 1

1

您是否在类接口中添加了该方法<UIPopOverControllerDelegate>并实现了该– popoverControllerDidDismissPopover:方法?dismissPopoverAnimated:当您在弹出框外点击时,只需在代码或 delgate 方法中显式调用。[self.kbiPopOver.delegate popoverControllerDidDismissPopover:self.kbiPopOver];从您的代码中删除它。

于 2012-05-29T09:55:22.213 回答