2013-09-24 71 views
-1

您好我是新手使用iOS SDK,我試圖做一個名稱,地址,電子郵件等的基本聯繫表格......這是我迄今爲止所做的。iOS聯繫表格問題

'- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
// Do any additional setup after loading the view, typically from a nib. 
} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
} 
- (IBAction)emailButton:(id)sender { 
MFMailComposeViewController *mailContoller = [[MFMailComposeViewController alloc]init]; 
[mailContoller setMailComposeDelegate:self]; 
NSString *email = @"******@gmail.com"; 
NSString *email1 = @"*******@hotmail.co.uk"; 
NSArray *emailArray = [[NSArray alloc]initWithObjects:email, email1, nil]; 
NSString *message = [[self myTextView]text]; 
[mailContoller setMessageBody:message isHTML:NO]; 
[mailContoller setToRecipients:emailArray]; 
[mailContoller setSubject:@"IT WORKS!"]; 
[self presentViewController:mailContoller animated:YES completion:nil]; 
} 

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [[self myTextView] resignFirstResponder]; 
} 
-(void)mailComposeController:(MFMailComposeViewController *)controller     didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error 
{ 
[self dismissViewControllerAnimated:YES completion:nil]; 
} 
@end 

我遇到的問題是,我不知道該怎麼做,這將通過電子郵件發送到一起的多個文本字段。 感謝和任何幫助將不勝感激。

+0

您好,感謝您的答覆,問題是IM還是很新的Xcode如何將我在連接字符串 – ash

回答

0

簡單地連接文本字段中的字符串。

NSString *message = [NSString stringWithFormat:@"%@\n%@\n%@", 
    textField1.text, textField2.text, textField3.text]; 
+0

您好,感謝您的答覆,問題是IM還是很新的Xcode如何將我串連的字符串。 – ash

+0

嗯。我向你展示瞭如何連接我的代碼示例中的字符串。請勾選複選標記並閱讀有關編程的基礎教科書。謝謝。 – Mundi