- ( void )presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
- ( void )presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
-(CGRect) frameOfSelection
{
return CGRectMake(self.frame.origin.x + left + SMALL_SIZE*position - SIZE_DIF,
self.frame.origin.y - LARGE_SIZE,
LARGE_SIZE,
LARGE_SIZE);
}
* This source code was highlighted with Source Code Highlighter .
- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
- called if the user performed an action that hides the pop-up window. May return NO to prevent hiding.- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
- notifies about hiding. The method is not called if -dismissPopoverAnimated: is called directly.- (id)initWithContentViewController:(UIViewController *)viewController
, passing the - (id)initWithContentViewController:(UIViewController *)viewController
required for display. If necessary, also set the delegate property.
presentPopoverFromRect: inView: permittedArrowDirections: animated:
presentPopoverFromBarButtonItem: permittedArrowDirections: animated:
-(void) didRotateFromInterfaceOrientation:
for UIViewController.
- ( void )didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[imageScrubberToolbar rebuild];
if ([popoverController isPopoverVisible])
{
[popoverController dismissPopoverAnimated:NO];
CGSize size = [self rotatedSize];
size.height -= imageScrubberToolbar.frame.size.height;
popoverController.popoverContentSize = size;
[popoverController presentPopoverFromRect:[imageScrubberToolbar frameOfSelection]
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
}
}
* This source code was highlighted with Source Code Highlighter .
-(CGSize)rotatedSize
{
if ((self.interfaceOrientation == UIInterfaceOrientationPortrait) ||
(self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
{
return self.view.frame.size;
}
else
{
return CGSizeMake(self.view.frame.size.height, self.view.frame.size.width);
}
}
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/91094/