anshul
anshul

Reputation: 846

The popover presented at wrong position on iOS8 (works as expected on iOS 7)

I am facing an issue related to the UIPopovers. The popover is positioned (that is, the xCoordinate and yCoordinate position) correctly on iOS 7.1, but on iOS 8, the same popover is popping up from a little above the desired y position. I have 2 popovers in my application: the first one is created programmatically and shown using the method :

presentPopoverFromRect:inView:

When I add an offset of 150 in the rect, then it appears at correct position on iOS8.

The second popover is loaded directly from storyboard using the segue.

So I have 2 questions here :

  1. Is there any way/approach which I can follow so that the same code works on both iOS 7 and 8 version.

  2. How can I handle/change the rect for the popovers which are presented/embedded to a button in the storyboard file.

If there is a solution for the first question, then I think that would solve the problem.

appreciate any help on this issue.

Upvotes: 1

Views: 534

Answers (1)

Dinesh Kaushik
Dinesh Kaushik

Reputation: 2987

In iOS 8 for presenting UIPopOverController

Instead of

popOverController.popoverContentSize = CGSizeMake(100 , 200 ); 

(popOverController is the object of class UIPopOverController)

Try this (for iOS 8)

controller.preferredContentSize = CGSizeMake(100 , 200 );

(controller is the view controller which you are presenting)

Upvotes: 1

Related Questions