Closed MarcoSpeziali closed 9 years ago
I'm having the same problem - e.g. iPad, launching in landscape mode - offset is wrong. But your code doesn't fix the bug at all. Maybe the GM version changed the behavior again. Have you found any solution?
Same problem on GM seed.
Had resolved in the same function, but swapping bounds coordinates with the following code:
CGFloat pWidth = portraitBounds.size.width; portraitBounds.size.width = portraitBounds.size.height; portraitBounds.size.height = pWidth;
Thanks! thats also a possible solution! I postet a pull request with commit 3134397 that also fixes the issue in several methods...
Here the entire method I actually use:
- (CGFloat) getOffsetForDirection:(PPRevealSideDirection)direction andInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { CGFloat offset = [[_viewControllersOffsets objectForKey:[NSNumber numberWithInteger:direction]] floatValue]; if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) { if (![self isOptionEnabled:PPRevealSideOptionsKeepOffsetOnRotation]) { // Take an orientation free rect CGRect portraitBounds = [UIScreen mainScreen].bounds; if (PPSystemVersionGreaterOrEqualThan(8)) { CGFloat pWidth = portraitBounds.size.width; portraitBounds.size.width = portraitBounds.size.height; portraitBounds.size.height = pWidth; } // Get the difference between width and height CGFloat diff = 0.0; if (direction == PPRevealSideDirectionLeft || direction == PPRevealSideDirectionRight) diff = portraitBounds.size.height - portraitBounds.size.width; if (direction == PPRevealSideDirectionTop) diff = -(portraitBounds.size.height - portraitBounds.size.width); // Store the offset + the diff offset += diff; } } return offset; }
Will it be included? Having the same issue on 8.1
@arodeus thanks for code - fixes the issue
@arodeus
Thanks for your solution
In iOS 8 if the device starts in landscape mode the offset between the left and the center view and between the center and the right one is wrong. I don't actually know if Apple changed something. Anyway I tried to fix the code:
The problem was in the method
[PPRevealSideViewController getOffsetForDirection:andInterfaceOrientation:]
The new code is:
I was trying to create a pull request but I don't know how to do that! :)