我有圖像的自定義導航欄通用於所有views.Also自定義導航欄,我有一個觀點MFMailComposer是presented.But我沒有得到默認與發送的導航欄和取消按鈕嘗試這兒過得從navbar.But不working.This去除圖像是我的嘗試:如何顯示在MFMailcomposer查看默認的導航欄,而不是在IOS
-(void)mailShare:(id)sender{
[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil) {
//[self displayMailComposerSheet];
// We must always check whether the current device is configured for sending emails
if ([mailClass canSendMail])
{
[self applyComposerInterfaceApperance];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Device not configured to send mail" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
alert = nil;
return;
}
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Device not configured to send mail" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
alert = nil;
return;
}
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
// [ picker.navigationBar setTintColor:[UIColor greenColor]];
[picker setSubject:@"Try this Pack from FORCE PACKS"];
CGRect rect = CGRectMake(0, 44, 320, 440);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[self.view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// Attach an image to the email
NSData *myData = UIImagePNGRepresentation(img);
[picker addAttachmentData:myData mimeType:@"image/jpeg" fileName:@"rainy"];
// Fill out the email body text
NSString *emailBody = @"I'm on the road to recovery! Check out my latest Exercise Log from FORCE Packs";
[picker setMessageBody:emailBody isHTML:NO];
[self presentViewController:picker animated:YES completion:nil];
myData = nil;
}
您可以添加您用於定製導航欄的代碼嗎? –
@Clever錯誤sure.this是代碼:[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@「navBar.png」] forBarMetrics:UIBarMetricsDefault]; –