简体   繁体   中英

UIViewController in NSObject not presenting when calling presentModalViewController

i'm new with iPhone developpement and i try to lunch a UIviewController when the user pressed a button witch will allow the user too send an email.

So my AppControler is a NSObject witch contains a UIWindow and a UIViewController* myViewController

When i detect the click on the button i create this:

 MFMailComposeViewController *picker =
 [[MFMailComposeViewController alloc] initWithNibName:@"MainWindow"
 bundle:nil];

  picker.mailComposeDelegate = myViewController;

... set the mail

and then when i try to present the view controller with this

 [myViewController presentModalViewController:picker animated:YES];

 [picker release];

Nothing append..

i know it's simple but i cant figured it out what is wrong.

thanks

Try using:

[ self presentModalViewController:picker animated:YES];

As @dannywartnaby mentioned unless myViewController points to the current view controller (self) it won't work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM