Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setPopoverContentSize: not working consistently on iOS 8, with xCode 6

Recently, I've upgraded to xCode 6. I have two iPads that I use for development; one is running iOS 7.1.2, and the other is running iOS 8.0.2.

In my application, I'm using a UIPopoverController to display a list of items in a UITableViewController. This has been working fine, from iOS 5 through iOS 7. I'm creating the UIPopoverController just once, and I reuse it often throughout the app. I want the popover to be sized just large enough to show the items in the list (anywhere from 1 to 5 items), so I'm calling setPopoverContentSize:animated: to resize the popover after I determine how large the display area should be.

As I mentioned, this has all been working fine. If I develop using the iPad that is running iOS 7, everything still works correctly. But if I use the iPad running iOS 8, the very first call to setPopoverContentSize:animated sizes the popup correctly - but only on the first call. All subsequent calls have no effect on the size of the popup.

The released version of the app still works correctly, even if it is running on iOS 8 (it was developed and submitted to Apple using xCode 5). So this appears to be a problem related to the combination of xCode 6 and iOS 8.

I haven't been able to figure out why only the first call to setPopoverContentSize:animated is working. Has anyone else seen this behavior? If so, how did you get sizing on the UIPopoverController to work correctly?

like image 923
Rick Morgan Avatar asked Mar 18 '23 04:03

Rick Morgan


1 Answers

For the record, I have discovered two ways of correcting this behavior. One is to recreate the UIPopoverController every time I want to use it.

The other way is to use the preferredContentSize of the UITableViewController instead of setPopoverContentSize:animated:.

And finally - as I noted, this is necessary if you are developing using xCode 6 for iOS 8.

like image 200
Rick Morgan Avatar answered Apr 26 '23 07:04

Rick Morgan