Closed flypigz closed 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.
(IBAction)detailPressed:(id)sender { BOOL isFold = [self isFold]; UIStoryboard storyboard = [UIStoryboard storyboardWithName:[AppDelegate storyboardName] bundle:nil]; DetailsViewController details = [storyboard instantiateViewControllerWithIdentifier:DETAILS_IDENTIFIER]; [details setFold:isFold]; [details setStyle:[self style]];
// push Details view controller onto navigation stack (using a fold or flip transition in our current style!)
if (isFold)
[self.navigationController pushViewController:details foldStyle:[self foldStyle]];
else
[self.navigationController pushViewController:details flipStyle:[self flipStyle]];
}
Good luck!
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).
thanks for your quick fix! :-)
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
(IBAction)infoPressed:(UIBarButtonItem )sender { UIStoryboard storyboard = [UIStoryboard storyboardWithName:[AppDelegate storyboardName] bundle:nil]; AboutViewController *about = [storyboard instantiateViewControllerWithIdentifier:ABOUT_IDENTIFIER];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:about]; [about setModalDelegate:self];
if ([self isFold]) [self presentViewController:nav foldStyle:[self foldStyle] completion:nil]; else [self presentViewController:nav flipStyle:[self flipStyle] completion:nil]; }
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.