2011-01-25 65 views
0

我有一个UIPopoverController,它是从我的UIViewController上的一个按钮提供的,但是当我点击视图的任何部分时,它不是隐藏的弹出窗口?从UIButton提供的UIPopoverController不会隐藏?

呈递本酥料饼的按钮是动态创建的,你会看到,在下面的代码中引用:

-(IBAction)showModifiers:(id)sender{ 

    [self.popoverController dismissPopoverAnimated:YES]; 

    UIView *theSuperview = self.view; 
    CGPoint touchPointInSuperview = [sender locationInView:theSuperview]; 
    UIView *touchedView = [theSuperview hitTest:touchPointInSuperview withEvent:nil]; 

    currentPopoverTag = [touchedView tag]; 
    NSLog(@"Show Modifiers %i %i", [touchedView tag], currentPopoverTag); 

    RepZioCoreDataAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; 
    if (appDelegate.popoverController) 
     [appDelegate.popoverController dismissPopoverAnimated:YES]; 

    self.modifierListPopoverViewController = nil; 
    ModifierListCollection *collection = [self.modifierLists objectAtIndex:[touchedView tag]-100]; 
    ModifierList *modifierList = [self getModifierList:collection.ModifierListID]; 
    self.modifierListPopoverViewController = 
    [[[ModifierListPopoverViewController alloc] initWithModifierList:modifierList withManufacturerID: self.manufacturerID] autorelease]; 
    self.modifierListPopoverViewController.delegate = self; 

    self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:modifierListPopoverViewController] autorelease]; 
    [self.popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
} 

回答

0

看来,一些人认为铲球触摸事件。

1

我意识到这不太可能,但您的ModifierListPopoverViewController类是否将其modalInPopover属性设置为YES? (默认值为NO,这应该会让你找到你想要的行为)。