i am trying and trying.... but no result yet.
i have a view with a navigationcontroller and -bar. in addition there is a tableview. if you click on a row, the iphone email function is getting startet by using the email example from apple (MailComposerViewController.h and .m). it opens and i am able to send or cancel the mail. after that the "dismissModalViewControllerAnimated" methode is dismissing the emailing view. everything looks right, i am in the previous view now, BUT: when i want to use buttons from the navigationitem or if i want to add rows to the tableview, the app is crashing without any error message. do i have to set something back or to "remove" something which is still there because of the mailing view? it's really strange and i am searching now for hours....... :-(
thank you very much in advance! hopefully someone has an idea.
EDIT: ok, here i have the code now:
in a tableview which is included in a navcontroller i have following lines to open first a Subclass of UIViewController:
- (IBAction)Action:(id)sender
{
DetailViewController *editViewController = [[DetailViewController alloc] initWithNibName:@"TripDetailViewController" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:editViewController animated:YES];
editViewController.navigationItem.prompt = @"Details";
[editViewController release];
}
in the DetailViewController following 开发者_如何转开发action is processed when the user clicks on the button:
- (IBAction)mailTrip:(id)sender {
MailComposerViewController *mailComposer = [[MailComposerViewController alloc] init];
[[[self view] window] addSubview:[mailComposer view]];
[mailComposer showPicker:sender];
}
when i press the related button, the MailComposerViewController pushes up correctly. all functions of the MailComposerViewController are working correct. but when i send or cancel the mail and the MailComposerViewController disappears, my previous view doesn't work anymore. in the MailComposerViewController-Example from apple the MailComposerViewController just disappear and the previous view is working fine again.... :-(
ok, i found the stupid simple problem. the MailComposer-View was after dismissing it still over the previous view.
i did set the propert hidden after dismissing and now it works...
[self dismissModalViewControllerAnimated:YES];
[[self view] setHidden:YES];
but i am really not sure if this is the right way to do it...
精彩评论