我想用UIBarButtonItem动作显示popoverview但我无法在故事板中添加popover segue。因为我以编程方式添加了UIBarButtonItem。
谢谢你的回复。
答案 0 :(得分:0)
@property (nonatomic, strong) UIPopoverController *yourPopOverController;
在你的行动方法中。
UIBarButtonItem *yourButton = (UIBarButtonItem *)sender;
YourViewController *yourViewControllerObject = [[YourViewController alloc]init];
yourPopOverController = [[UIPopoverController alloc] initWithContentViewController:yourViewControllerObject];
yourPopOverController.delegate = self;
[yourPopOverController presentPopoverFromBarButtonItem:yourButton permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];