mpospese / MPFoldTransition

Easily add custom folding and page-flipping transitions to UIViews and UIViewControllers
http://markpospesel.com/2012/05/07/mpfoldtransition/
1.81k stars 238 forks source link

When presenting a NavigationController, the snapshot image is incorrect #6

Closed flypigz closed 12 years ago

flypigz commented 12 years ago

I want to present a Modal View controller, which is an instance of UINavigationController.

How to Reproduce: embed the about view controller inside a UINavigationController

Root Cause: the snapshot height is minus 20 by mistake, and the 20 is the height of the statusbar, so I think the calculation of rect in MPTransition is incorrect. In above test case, the rect value should be {{0, 0}, {320, 416}}, but it is changed to {{0, 20}, {320, 460}} in the - (void)setPresentingController:(UIViewController *)presentingController method of MPTransition class.

@property (assign, nonatomic) CGRect rect;

Would you please help to look at this issue? thanks a lot.

mpospese commented 12 years ago

Sounds like you're using the wrong API. The one you're using is for modally presenting a view- i.e. to occupy the full screen on iPhone. That will always be either 460 or 480 points tall for portrait (unless you're in a call in which case it is -20 more points) - i.e. it will always cover your entire app (including all navbars and toolbars) and leave only the status (and optional call status) bars visible.

I think what you want instead is the API used in detailPressed to push a view controller onto the navigation stack.

Good luck!

mpospese commented 12 years ago

Disregard my previous comment, I misread your issue. You're correct that the calculation is off by 20 when presenting a UINavigationController. But the rect shouldn't be {{0,0}, {320, 416}} - that's the size of the About controller within the nav controller. Probably the size passed to the nav controller needs to be a full 480 points high and not 460. Might need to not subtract off status bar height if the presented controller is of certain container controller types (e.g. UINavigationController and possibly other system controllers).

flypigz commented 12 years ago

thanks for your quick fix! :-)