AppleのサンプルコードをMessageUIとMFMailComposeViewControllerDelegateに使用していますが、ほとんどの場合うまくいきます。しかし、私はそれを実装する何らかの理由で、受信者フィールドのテキストがフィールドラベルと一直線にならず、入力中にカーソルの半分とテキストの半分しか見ることができません。アドレスを入力してフィールドを終了すると、テキストは完全に表示されますが、まだラベルとの位置がずれています。私は他のアプリのMessageUIの実装を見てきましたが、この問題はないようです。誰もこの問題を見て解決策を見つけましたか?以下MFMailComposeViewControllerを起動すると受信者のテキストが途切れます
コードである:
-(void)displayComposerSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Data"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
[picker setToRecipients:toRecipients];
// Attach an attachment to the email
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *csvFile = [documentsDirectory stringByAppendingPathComponent:@"myFile.csv"];
NSData *myData = [NSData dataWithContentsOfFile:csvFile];
NSString *filename = @"myFile.csv";
[picker addAttachmentData:myData mimeType:@"text/csv" fileName:filename];
// Fill out the email body text
NSString *emailBody = @"Attached is the data";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
}
問題は、シミュレータの両方で、デバイス上に発生します。
それはまさにそれでした。ありがとう! –