Iphone 如何从视图和视图控制器中删除关联?
当我发送电子邮件(使用MFMailComposeViewController)后尝试显示facebook共享时,我收到以下错误: 一个视图一次最多只能与一个视图控制器关联 时间视图[EAGLView]与[EmailViewController]关联。清楚的 将此视图与[FacebookView]关联之前,请先删除此关联 [EmailViewController从ParentViewController移除];无所事事 EmailViewController.view=nil;导致白色屏幕,即使电子邮件表单早已消失 如何让它忘记我曾经发送过邮件和电子邮件,并使视图层次结构恢复到以前的状态?如果我没有发送电子邮件,facebook共享就可以工作Iphone 如何从视图和视图控制器中删除关联?,iphone,objective-c,ios6,facebook-ios-sdk,Iphone,Objective C,Ios6,Facebook Ios Sdk,当我发送电子邮件(使用MFMailComposeViewController)后尝试显示facebook共享时,我收到以下错误: 一个视图一次最多只能与一个视图控制器关联 时间视图[EAGLView]与[EmailViewController]关联。清楚的 将此视图与[FacebookView]关联之前,请先删除此关联 [EmailViewController从ParentViewController移除];无所事事 EmailViewController.view=nil;导致白色屏幕,即使电
-(IBAction)ShowEmailForm:(char*)pSubject :(char*)pBody :(char*)pTo
{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
if ([mailClass canSendMail])
{
self.view = eaglView;
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:[NSString stringWithFormat:@"%s", pSubject]];
// Set up recipients
if( pTo != nil )
{
NSArray *toRecipients = [NSArray arrayWithObject:[NSString stringWithFormat:@"%s", pTo]];
[picker setToRecipients:toRecipients];
}
// Fill out the email body text
[picker setMessageBody:[NSString stringWithFormat:@"%s",pBody] isHTML:YES];
[self presentViewController:picker animated:YES completion:^(){}];
[picker release];
}
}
}
// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self dismissViewControllerAnimated:YES completion:^(){ printf("Email form done dismissing.\n"); }];
printf("Email form dismissed.\n");
[self removeFromParentViewController];
//Email was sent.
if (result == MFMailComposeResultSent)
{
printf("Email Sent!\n");
NSString *pEmail = [self findEmailAddresses:controller.view : 0];
}
}
修好了
改变
self.view = eaglView;
到
首先,您是如何演示MFMailComposeViewController的?-(iAction)ShowEmailForm:(char*)psObject:(char*)pBody:(char*)pTo{Class mailClass=(NSClassFromString(@“MFMailComposeViewController”);if(mailClass!=nil){if([mailClass canSendMail]){self.view=eaglView;MFMailComposeViewController*picker=[[MFMailComposeViewController alloc]init];picker.mailComposeDelegate=self;[picker setSubject:[NSString stringWithFormat:@“%s”,psObject]];[self presentModalViewController:picker动画:是];[picker release];}}把它加到你的问题里去,否则很难读懂
[eaglView addSubview:self.view];