UIPopoverController changing the location of a UIPopoverArrowDirection

I want to move the UIPopoverArrowDirection to the left so that the actual arrow is no longer centered, but more than 25% on the left and 75% on the right.

To understand what I mean, to see two screenshots, I want it to look like the second ...

Normal popover

The Popover with correctly placed arrow that I want

The problem is that there is no real way to dig into the popover class ... If someone has not made a third party that I can use?

In any case, if anyone knows how to solve this problem, it seems to be a trivial problem ... please let me know ...

~ Dave

+5
source share
3 answers

, "presentPopoverFromRect" .

example doing this

, , . - , UIToolbar UINavigationBar. r - UIToolbar, , ( ), . MGSettingsView - ( " ", " " ..).

UINavigationItem *item = scrollView.navbar.topItem;
UIToolbar *authorTools = (UIToolbar *)[item.rightBarButtonItem customView];
CGRect r = authorTools.frame;
r.size.width = 18;
r.origin.x += 12;

CGSize popoverSize = CGSizeMake(300.f, 500.f);
MGSettingsView *settingsView = [[MGSettingsView alloc] initWithSize:popoverSize];
UIPopoverController *poctl = [[UIPopoverController alloc] initWithContentViewController:settingsView];
settingsView.popover = poctl;
poctl.delegate = self;
poctl.popoverContentSize = popoverSize;
[poctl presentPopoverFromRect:r inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[settingsView release];

, , , .:)

+7

UIPopoverController (Rect). popoverArrowDirection, , . popover, , , .

+1

Check below the method in which you can specify the direction for the direction of the arrow.

- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
0
source

All Articles