views:

269

answers:

1

Hi guys, my first post here :) I'm having a small trouble with a small but boring problem. I have a view, with a NavigationController. I load in the NC a simple view. Inside this view there's abutton where I fire the presentModalView... in the main view, not on NC, but it's parent view:

ABVIEW > NC > NEWVIEW

new attach a presentModalView... on ABVIEW, so [abview present...]; No problem till now. When it's the time to dismiss, after the temporary window (let's calls it NOTES) disappear, my ABVIEW with all the subviews change Y position from 0 to 20, the same height of the status bar. I was looking everywhere and I'm sure it's a stupid thing, but I miss a bit of knowledge here and I have no idea where to find the solution.

thanks in advance!

A: 

Have you tried calling presentModalViewController:... on NC instead of ABVIEW?

Also, you generally don't want to explicitly make UINavigationController's view a subview of another view, unless that other view is your UIWindow. So perhaps you can get rid of ABVIEW?

Tom
Ok,it's working attaching the ViewController on NC.But why if I attach the view to a parent of NC, NC will move soon themodal view is gone? I dont understand the dynamic of this.
DigitalVanilla
I don't know exactly how you've laid out your views, set your autoresizing masks, etc., but the behavior of many UIKit view controllers' views is complicated when they are manually added to a superview other than UIWindow. That's why you should prefer to make UINavigationController a direct subview of UIWindow, and use methods like `-[UITabBarController setViewControllers:]` and `-[UINavigationController pushViewController:animated:]` to create a heirarchy of views.
Tom