我有這樣的代碼來呈現酥料餅:如何關閉在DidSelectRow上的UIPopover?
- (UIPopoverController *)favoritesPopover
{
if (!favoritesPopover)
{
FavoritesViewController *fvc = [[FavoritesViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:fvc];
[fvc release];
favoritesPopover = [[UIPopoverController alloc] initWithContentViewController:navController];
[navController release];
favoritesPopover.delegate = self;
}
return favoritesPopover;
}
- (IBAction)toggleFavorites:(id)sender
{
if (!self.favoritesPopover.popoverVisible)
[self.favoritesPopoverpresentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
else
[self.favoritesPopover dismissPopoverAnimated:YES];
}
現在,當didSelectRow
被稱爲FavoritesViewController
,我要被開除的酥料餅。我嘗試了[self dismissPopoverAnimated: YES];
但這不被認可。
也許你應該從這個函數返回'booksmarksPopover'?另外,你在哪裏/如何展示popover? –
這是一個錯字,現在修復。我通過一個UIBarButtonItem呈現這個,增加了更多的代碼。 – Jon