所以我有一个带有按钮的popover.当按下该按钮时,我希望弹出窗口消失.这似乎很容易,但我无法弄清楚我的生活.我用来显示popover的代码如下:
AddCategoryViewController* content = [[AddCategoryViewController alloc] init]; UIPopoverController* aPopover = [[UIPopoverController alloc] initWithContentViewController:content]; aPopover.delegate = self; [content release]; // Store the popover in a custom property for later use. self.addCategoryPopover = aPopover; [aPopover release]; [addCategoryPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
在addcategoryviewcontroller中,我有:
-(IBAction)saveAddCategory:(id)sender { if (rootViewController == nil) rootViewController = [[RootViewController alloc] init]; [rootViewController.addCategoryPopover dismissPopoverAnimated:YES]; [rootViewController dismissPopover]; }
Rootviewcontroller是创建popover的地方.不幸的是,这些方法都没有解决它.任何帮助?