开发者

UIPopoverController Anchor Position

I have a UIPopOverController for which the content controller is a UINavigationController. I'm resizing the popover size according to the content size of the controller pushed/popped into it. Initally i'm presenting the popover by using the method presentPopoverFromRect:inView:permittedArrowDirections:animated:. The anchor position is pointing at the center of the rect which i passed as an argument. If i push a controller(whose content size is small) into the navigationController , the popover shrinks from the bottom and moves above the rect which i mentioned earlier.

I tried to present the popover everytime(for push/pop) , anchor position remains @ same point But the animation gets affected , doesnt looks good.

what needs to be done to make the anchor position remains same irrespective of the change in popover siz开发者_如何学运维e variation ?


I've encountered the same issue and it seems that calling the presentPopoverFromRect method again will keep the anchor at the same position

e.g.

[self.myPopOver presentPopoverFromRect:rectOrigin inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];

Hope it works in your case as well


Change frame after presenting UIPopoverController:

 [popupController presentPopoverFromRect:btn.frame inView:self.view permittedArrowDirections:0 animated:YES];

CGRect popupFrame = popupController.contentViewController.view.superview.superview.superview.frame;
popupFrame.origin.y = btn.frame.origin.y + btn.frame.size.height+75;

popupController.contentViewController.view.superview.superview.superview.frame = popupFrame;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜