Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 8 - iPad - UISplitViewController issue. #157

Closed
skilau opened this issue Mar 27, 2015 · 1 comment
Closed

iOS 8 - iPad - UISplitViewController issue. #157

skilau opened this issue Mar 27, 2015 · 1 comment
Labels

Comments

@skilau
Copy link

skilau commented Mar 27, 2015

Hi!
This report might be a bit long in explanation.
I have a fix as well, but I am not positive of the ramifications of it.

We have an existing app that used a 3rd party lib called MGSplitViewController, which I have ported back to the iOS standard UISplitViewController, because Apple updated the Controller to work extremely well now.

The UISplitViewController shows 2 panels, a primary (on the left) and a secondary panel (on the right).
I display a TableView on the primary panel, which will call ActionSheetPicker when a user selects certain items in the TableView.

What I was seeing initially was that we would get extremely long delays when displaying the ActionSheetPicker.
Like, I would show the picker in my code, and it would take 5-20 seconds for the actual View/Picker to display on the iPad.
It would be random. Sometimes it would take 1-2 seconds, others it could take 15-20 seconds.

Extremely bizarre!

If changing the code in ActionSheetPicker to have the iPad path just take the iPhone path instead, the display worked fine, and was fast.
(And of course, on an iPhone, it works perfectly as well)

After googling and searching a bit, I have found that there a few other people/projects that have had the same problem for the iPad and iOS 8.

Every response out there, suggests to put the call into a dispatch_async() call.

So I took this line:
[popover presentPopoverFromRect:_containerView.bounds inView:_containerView
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

And wrapped it into a dispatch_async() like so:

   dispatch_async(dispatch_get_main_queue(), ^{
        [popover presentPopoverFromRect:_containerView.bounds inView:_containerView
           permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

    });

And indeed, this solved the problem!

The Popover pops up instantly and without delay, and working as expected.

I don't know the ActionSheetPicker library well enough to know whether doing this wrap hurts anything else in the library, but it sure appears to work well.

@skywinder
Copy link
Owner

Hi! Thanks a lot for a great explanation! 👍
I remember, that some people also mention it!
I don't see anything bad to call present async from main queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants