ViewDidAppear is called before the view appear

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ViewDidAppear is called before the view appear

c0ld
Hello. Have some problem again. When I switching to some viewcontroller(secondVC) using PresentViewController like this:

this.NavigationController.PresentViewController(new UINavigationController(secondVC){
        ModalTransitionStyle= UIModalTransitionStyle.CoverVertical,
     }, false,null);

If paramter "animated" set in false, func ViewDidAppear in secondVC will be called before the view is displayed. Is it normal for function with name ViewDidAppear ?

Thanks.

Test project: https://github.com/c0ldd/MonotouchTest
Reply | Threaded
Open this post in threaded view
|

Re: ViewDidAppear is called before the view appear

Nic Wise
It may be that the SecondVC is "appearing" inside the
UINavigationController, which is then shown (animated)

Can you hook onto the UINavigationController's ViewDidAppear? Or try
to present just your SecondVC to see if thats the issue (ie, don't
wrap it in the UINavController)



On 26 March 2013 09:41, c0ld <[hidden email]> wrote:

> Hello. Have some problem again. When I switching to some
> viewcontroller(secondVC) using PresentViewController like this:
>
> this.NavigationController.PresentViewController(new
> UINavigationController(secondVC){
>         ModalTransitionStyle= UIModalTransitionStyle.CoverVertical,
>      }, false,null);
>
> If paramter "animated" set in false, func ViewDidAppear in secondVC will be
> called before the view is displayed. Is it normal for function with name
> ViewDidAppear ?
>
> Thanks.
>
> Test project: https://github.com/c0ldd/MonotouchTest
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/ViewDidAppear-is-called-before-the-view-appear-tp4658184.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: ViewDidAppear is called before the view appear

c0ld
I set animated=false in AppDelegate, when i present firstVC. And ViewDidAppear was called before there view, like in secondVC. I think it doesn't depend on the order of viewcontrollers. What should I do?
Reply | Threaded
Open this post in threaded view
|

Re: ViewDidAppear is called before the view appear

Nic Wise
Because you are not showing your secondVC directly, it's ViewDidAppear
will be called when it appears in it's parent (the
UINavigationController).... which is then animated onto the screen.

You could hook into the UINavigationController's ViewDidAppear and
then call the child one (or a similar method) when it gets called...

ViewDidAppear might not be a good one for this tho. If you animate it
on screen (which you are doing), then it "appears" offscreen, and is
then moved, which isn't what you are expecting to happen.

The last param of

this.NavigationController.PresentViewController(new
UINavigationController(secondVC){
        ModalTransitionStyle= UIModalTransitionStyle.CoverVertical,
     }, false,null);

which you pass null into is a callback for when the animation has
finished. You could do something in there, eg:

delegate { secondVC.YoureOnTheScreenNow(); }



On 27 March 2013 06:26, c0ld <[hidden email]> wrote:

> I set animated=false in AppDelegate, when i present firstVC. And
> ViewDidAppear was called before there view, like in secondVC. I think it
> doesn't depend on the order of viewcontrollers. What should I do?
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/ViewDidAppear-is-called-before-the-view-appear-tp4658184p4658190.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch