所以我有一个带有按钮的弹出窗口。当按下该按钮时,我希望弹出框消失。这似乎很容易,但我无法为我的生活弄清楚。我用来显示弹出框的代码如下:
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 是从中创建弹出框的地方。不幸的是,这些方法都不能消除它。有什么帮助吗?