【发布时间】:2011-12-19 14:07:24
【问题描述】:
我在我的 Xcode 项目中创建了一个包含 2 个文本字段的表单,用户在其中插入他当前的地址和目的地。当我点击第二个文本字段中的发送返回键时,消息撰写控制器显示良好。
但是,问题在于消息的正文并没有从 text field 和 message 中“拖动”值。所以我希望我的文本字段中的值包含在消息正文中。 哪里有问题 ?
-(IBAction)btnSendSms:(id)sender {
[sender resignFirstResponder];
[[UIApplication sharedApplication ] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if ([MFMessageComposeViewController canSendText]) {
controller.body = @"My body text %@: " , textField1.text , textField2.text;
controller.recipients = [NSArray arrayWithObjects:@"011888",nil];
controller.messageComposeDelegate = self;
controller.navigationBar.tintColor = [UIColor blackColor];
[self presentModalViewController:controller animated:YES];
【问题讨论】:
标签: iphone xcode sdk uitextfield