I implemented an UIPopoverController which is filled with a grouped UITableView. The number of cells in the table view can change dynamicly as long the popover is invisible. As soon as the popover becomes visible, the number of cells are fixed.
When the popover becomes visible, i resize the popover content to the height of the table view. I use the SizeThatFits() method from the UITableView to get the table size and use this value to set the popover PopoverContentSize height.
This works fine when the app is running. But always the first time the popover is shown after a new start of the app, SizeThatFits() delivers a wrong height (about 60 pixel to high). Has anyone an idea what this problem could be?
I had a somewhat similar issue because I was performing my calculations in ViewDidLoad. I was able to work around the issue by creating a bool flag in the view's code and only performing the calculations in ViewDidAppear if the flag was not set (and, of course setting the flag so that the logic wasn't repeated each time).
On iOS 5 and up, sizeThatFits on a UITableView gives the correct result when called within the viewDidLayoutSubviews UIViewController method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With