当点击 UIButton 以显示 UIPopovercontroller 时,它会显示在另一个 UIbarbuttonite 上,并且它会显示空白的黑色不透明 UIPopovercontroller。
这是我实现的代码:
- (IBAction)buttonTapped:(id)sender {
UIButton *btnAction;
BookmarkViewController* bookmarkVC = [[BookmarkViewController alloc] init];
_buttonPopoverController = [[UIPopoverController alloc]
initWithContentViewController:bookmarkVC];
_buttonPopoverController.delegate = self;
CGRect popoverFrame = btnAction.frame;
[_buttonPopoverController setPopoverContentSize:CGSizeMake(320, 355) animated:NO];
//only required if using delegate methods
[_buttonPopoverController presentPopoverFromRect:popoverFrame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:YES];
}