I have a view with a bunch of buttons in a UIScrollView . When the user clicks the button, I want the UIPopOverController to display a pointer to the selected button. This seems to work, but the popover is the wrong size and points to a random point in the view. Here is my code
-(void)detail:(id)sender{ UIButton *button = sender; NSLog(@"tag = %i", button.tag); UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { self.popover = [[UIPopoverController alloc] initWithContentViewController:navController]; self.popover.delegate = self; [self.popover presentPopoverFromRect:button.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; }
What is the problem with the size of the popover: In the view that is inside the popover, I have:
self.contentSizeForViewInPopover = scroll.contentSize; NSLog(@"%f, %f", scroll.contentSize.height, scroll.contentSize.width); NSLog(@"showing: %f, %f", self.contentSizeForViewInPopover.height, self.contentSizeForViewInPopover.width);
and both logs match. Therefore, I think that everything should work correctly. But this is not so. Here is a screenshot. Let me know if you need more of my code. Thank you in advance.

iphone ipad uiscrollview popover uipopovercontroller
Andrew Jul 21 2018-11-11T00: 00Z
source share