Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS8 MGSplitViewController alternative

I am using MGSplitViewController library in my app. Till iOS7 it works fine but for iOS8 it is not working as expected because of the change of behaviour of UIPopoverController in iOS8. Attached is the screenshot of running MGSplitView code on iOS8 :

iOS 8 MGSplitView

which is showing the wrong behaviour. It is supposed to be like the following screenshot : enter image description here

I have read somewhere that MGSplitViewController library will not be updated for iOS8 fixes.Does anyone know if we have another library which works fine for iOS8 as well and has similar features as of MGSplitViewController.

like image 801
XYZ Avatar asked Aug 11 '14 15:08

XYZ


1 Answers

I faced the same issue and found a fix for it. Go to MGSplitViewController.m and find the following lines in -splitViewSizeForOrientation: (around line 261):

width = height;
height = fullScreenRect.size.width;

Make sure it does not run on iOS 8, as iOS 8 will handle sizes properly. Maybe like this.

if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIInterfaceOrientationIsLandscape(theOrientation)) {
    width = height;
    height = fullScreenRect.size.width;
}

Then find the following line in -reconfigureForMasterInPopover: (around line 614):

[_hiddenPopoverController presentPopoverFromRect:CGRectMake(-2000, -2000, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];

And make sure it does not run on iOS 8. Again, maybe like this.

if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
    [_hiddenPopoverController presentPopoverFromRect:CGRectMake(-2000, -2000, 1, 1) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
}
like image 179
simonbs Avatar answered Sep 21 '22 17:09

simonbs