[MonoTouch] How to use "PresentModalViewController"

Brent Schooley schooleybrent at gmail.com
Mon Oct 5 15:42:37 EDT 2009


Adam,

I did exactly what you are trying to do in this other app.  I'll have to dig
up the code.  It works fine.

Brent

On Mon, Oct 5, 2009 at 3:30 PM, Adam Langley <alangley at winscribe.com> wrote:

> Aha! I found the problem.
> It was prototype code that I was trying this out in, and I was attempting
> to push a modal view from within the 'ViewDidLoad' method of the parent
> view.
> It seems that you're not allowed to do this, and must call it from within a
> delegate (just a different point in the lifecycle).. so I did
> It on a button click, and it worked fine...
> I just wanted a modal view to render as soon as the app loaded, do some
> prep, then hide... I guess I'll have to find another location to kick-off
> the view on startup.
>
>
> Adam Langley
>
>  Please consider the environment before printing this email!
>
> From: Brent Schooley [mailto:schooleybrent at gmail.com]
> Sent: Tuesday, 6 October 2009 6:55 a.m.
> To: Adam Langley
> Cc: monotouch at lists.ximian.com
> Subject: Re: [MonoTouch] How to use "PresentModalViewController"
>
> Without seeing your code, my guess is there's a problem in whatever
> controller you are displaying modally.  The call to
> PresetModalViewController is very simple and I can confirm that it works
> (just wrote an app yesterday that uses it).  Poke around your modal view
> controller for null references, etc.
>
> Brent
> On Mon, Oct 5, 2009 at 1:51 PM, Adam Langley <alangley at winscribe.com>
> wrote:
> Hi Kevin,
>
> So are you saying that the call to "PresentModalViewController" is non-
> blocking?
> Because your code looks very similar to mine... The difference being
> that mine doesn't work...
> I don't have any call to dispose, or dismiss, so I don't _think_ it's
> getting destroyed... I'll have another tinker today
>
> Btw ...  Nice to see the .co.nz represented here (c:
>
> On 5/10/2009, at 11:00 PM, "Kevin Daly" <kevindaly at xtra.co.nz> wrote:
>
> > I'm currently using a bit of code like this successfully:
> >
> > login = new LoginController();
> > login.ModalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
> > navigationController.PresentModalViewController(login,true);
> > login.ButtonPressed+=(sender,args)=>
> > {
> >    RequestData();
> >    navigationController.DismissModalViewControllerAnimated(true);
> > }
> >
> >
> > ...where the lines featuring navigationController (the instance
> > variable for
> > my NavigationController) are the most relevant.
> >
> > When I first tried this I had the whole thing in a "using" block,
> > and spent
> > almost a week trying to work out why nothing was happening - then I
> > realised
> > that nothing was waiting for the ModalViewController to do anything
> > before
> > proceeding, so it was effectively being dismissed and destroyed
> > immediately.
> > I'd been fooled by my expectations from working with modal dialogs in
> > Windows Forms.
> >
> > -----Original Message-----
> > From: monotouch-bounces at lists.ximian.com
> > [mailto:monotouch-bounces at lists.ximian.com] On Behalf Of Adam Langley
> > Sent: Monday, 5 October 2009 9:41 p.m.
> > To: monotouch at lists.ximian.com
> > Subject: [MonoTouch] How to use "PresentModalViewController"
> >
> > I am trying to display a modal view, but I just can't get it to
> > work... No exceptions, just nothing happens...
> >
> > Any possibility someone can make this a blogging priority? (c;
> >
> > Adam Langley
> >
> > Sent from my iPhone
> > _______________________________________________
> > MonoTouch mailing list
> > MonoTouch at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/monotouch
> >
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091005/9b97b89d/attachment.html 


More information about the MonoTouch mailing list