我在点击导航栏右键时添加了popOvercontroller。我不想要动画效果..可以有人告诉我如何禁用它吗???
答案 0 :(得分:6)
这有两件事。使用presentPopoverFromBarButtonItem:allowedArrowDirections:animated:NO或presentPopoverFromRect:allowedArrowDirections:animated:NO表示弹出窗口将阻止“出现”动画。要禁用禁用“消失”,我必须将其添加到委托:
- (BOOL) popoverControllerShouldDismissPopover:(UIPopoverController *)popover {
// Any cleanup code (popoverControllerDidDismissPopover won't be called)
[popover dismissPopoverAnimated:NO];
return NO;
}
答案 1 :(得分:1)
你如何实例化它?文档提到presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
- 听起来像是你问题的完美答案。
答案 2 :(得分:0)
顺便说一下。如果您正在从表视图中显示弹出窗口,则您将需要在弹出窗口被取消时同时为行取消选择设置动画。为此,您可以使用:
- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popover {
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
[popover dismissPopoverAnimated:YES];
return NO;
}