2011-01-25 89 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,這應該會讓你找到你想要的行爲)。