So I have a view
with a bunch of button in a UIScrollView
. When the user presses a button, I want a UIPopOverController to display pointing at the selected button. It kind of works, but the popover is the wrong size and points to a random point in the view. Here is my code. Thanks in advance.
-(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];
}
Than 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 are matching. So I think everything should work correctly. But it doesn't. Here is a screen shot. Let me know if you need more of my code. Thanks in advance.