Could anyone confirm me the maximum size of a popoverview?
Than开发者_开发百科ks
From the setPopoverContentSize:
documentation:
When changing the size of the popover’s content, the width value you specify must be at least 320 points and no more than 600 points. There are no restrictions on the height value. However, both the width and height values you specify may be adjusted to ensure the popup fits on screen and is not covered by the keyboard.
I've found 585 seems to be the maximum, any larger and the whole thing wanders to the left with each size change.
I just verified that this code works on an iPad 1 and iPad 4 (meaning it is supported in iOS 5.1.1 - 6.1.2)
popover = [[UIPopoverController alloc] initWithContentViewController:yourVC];
[popover setPopoverContentSize:CGSizeMake(1024, 1024)];
[popover presentPopoverFromRect:CGRectZero
inView:appDelegate.splitViewController.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
You should note that it's difficult to dismiss the popover since it will "fill the screen" in portrait or landscape. I do have these methods in my appDelegate.splitViewController:
- (BOOL)shouldAutomaticallyForwardRotationMethods {
NSLog(@"MG - shouldAutomaticallyForwardRotationMethods");
return YES;
}
- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers {
NSLog(@"MG - automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers");
return YES;
}
Just unhide/hide a button in a corner of yourVC to dismiss with this:
[popover dismissPopoverAnimated:YES];
It should also be noted that "popover" is a strong property, or you will get a deallocated message when it tries to present.
精彩评论