【问题标题】:Xcode MFMessageComposeViewController status bar & text fieldXcode MFMessageComposeViewController 状态栏和文本字段
【发布时间】: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


    【解决方案1】:

    你应该更正正文字符串:

    controller.body = [NSString stringWithFormat:@"My body text %@: %@", textField1.text, textField2.text ];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-10
      • 1970-01-01
      • 2014-11-01
      • 1970-01-01
      • 2020-11-18
      • 1970-01-01
      相关资源
      最近更新 更多