NSMutableArray
을 NSString
으로 변환하려고합니다 (또는 복사합니까?). 나는 내 문제가 인 것을 짐작한다. 나는 NSString
의 구조를 정말로 이해하지 못한다. 변환 후 이메일 본문에 첨부하고 싶습니다. 여기 내 코드는 다음과 같습니다.어떻게 NSMutableArray를 NSString으로 변환 할 수 있습니까?
- (IBAction)sendEmail
{
NSLog(@"sendEmail");
[textView resignFirstResponder];
[textView1 resignFirstResponder];
if ([MFMailComposeViewController canSendMail])
{
// set the sendTo address
NSMutableArray *recipients = [[NSMutableArray alloc] initWithCapacity:1];
[recipients addObject:@"[email protected]"];
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Iphone Game"];
NSString *string = [string appendString:[NSString stringWithFormat:"%@", [viewArray objectAtIndex:i]]];
[controller setMessageBody:string isHTML:NO];
[controller setToRecipients:recipients];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"Your device is not set up for email." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
무엇이 문제입니까? 명확하게 설명 할 수 있습니까? – Dinesh
같은 : -http : //stackoverflow.com/questions/8802543/how-to-convert-nsmutablearray-into-nsstring/8802630#8802630 – Leena