我NSMutableArray的數據在NSData的formate.I正在試圖連接的NSMutableArray數據到電子郵件body.Here是我的NSMutableArray代碼:電子郵件中附加的數據?
NSUserDefaults *defaults1 = [NSUserDefaults standardUserDefaults];
NSString *msg1 = [defaults1 objectForKey:@"key5"];
NSData *colorData = [defaults1 objectForKey:@"key6"];
UIColor *color = [NSKeyedUnarchiver unarchiveObjectWithData:colorData];
NSData *colorData1 = [defaults1 objectForKey:@"key7"];
UIColor *color1 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData1];
NSData *colorData2 = [defaults1 objectForKey:@"key8"];
UIFont *color2 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData2];
CGFloat x =(arc4random()%100)+100;
CGFloat y =(arc4random()%100)+250;
lbl = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 100, 70)];
lbl.userInteractionEnabled=YES;
lbl.text=msg1;
lbl.backgroundColor=color;
lbl.textColor=color1;
lbl.font =color2;
lbl.lineBreakMode = UILineBreakModeWordWrap;
lbl.numberOfLines = 50;
[self.view addSubview:lbl];
[viewArray addObject:lbl ];
viewArray是我的NSMutableArray。所有在viewArray數據存儲在NSData的formate.I嘗試此代碼以附加在電子郵件viewArray數據。
- (IBAction)sendEmail {
if ([MFMailComposeViewController canSendMail])
{
NSArray *recipients = [NSArray arrayWithObject:@"[email protected]"];
MFMailComposeViewController *controller = [[MFMailComposeViewController
alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Iphone Game"];
NSLog(@"viewArray: %@", viewArray);
NSString *string = [viewArray componentsJoinedByString:@"\n"];
NSString *emailBody = string;
NSLog(@"test=%@",emailBody);
[controller setMessageBody:emailBody isHTML:YES];
[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];
}
}
在這裏,我看到的對象存儲在viewArray.in安慰其看起來像這樣.. [2012-05-07 18:48:00.065註釋列表[279:207]測試=的UILabel:0x8250850; frame =(140 341; 56 19); text ='Xxxxxxx'; clipsToBounds = YES;層=>但在電子郵件我只看到這個.. >>請建議任何一個我怎麼能附加我的viewArray數據在電子郵件。 ]
不,他們不是NSData的格式,如果他們的電子郵件,他們不會顯示爲[2012-05-07 18:48:00.065注意列表[279:207] test = UILabel:0x8250850; frame =(140 341; 56 19); text ='Xxxxxxx'; clipsToBounds = YES;層=>在烏拉圭回合的NSLog – Saad
uilable顯示陣列類數據的 – Saad
看到雁 – Saad