MFMessageComposeViewController错误地关注该字段

时间:2015-01-19 14:23:10

标签: ios ios8 uitextview

我正在实施通过短信邀请朋友的可能性,并且出现小问题。问题与对该领域的错误关注有关。

下面的图片描述了问题:

Image from iphone

因为有可能看到焦点在词“кому:”之前,而不是之后。

有人可以帮助我了解如何在MFMessageComposeViewController中设置适当的焦点。

显示短信视图的代码如下:

if ([MFMessageComposeViewController canSendText])
{
            MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
            [messageController setBody:@"I'm on Memry, come join me! =) \n https://itunes.apple.com/us/app/memry/id735465896?mt=8"];
            messageController.navigationBar.titleTextAttributes = @{
                                                                   NSForegroundColorAttributeName: [UIColor blackColor],
                                                                   };
            messageController.messageComposeDelegate = self;
            [self.view.window.rootViewController presentViewController:messageController animated:NO completion:nil];
            [messageController release];
        }
        else
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Memry"
                                                            message:@"Your device does not support SMS"
                                                           delegate:nil
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil];
            [alert show];
            [alert release];
}

1 个答案:

答案 0 :(得分:1)

    MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
    [messageController setRecipients:@[@"+86 15011582532"]];
    [messageController setBody:@"I'm on Memry, come join me! =) \n https://itunes.apple.com/us/app/memry/id735465896?mt=8"];
    messageController.navigationBar.titleTextAttributes = @{
                                                            NSForegroundColorAttributeName: [UIColor blackColor],
                                                            };
    messageController.messageComposeDelegate = self;
    [self.view.window.rootViewController presentViewController:messageController animated:NO completion:nil];

在收件人中添加一些默认值。