Question

I have created an application that uses the SMS and after the user clicks the sms button it opens up with my number already in and no message (thats their job). But when it loads up the sms message page it set the curser thing is up where the recipients are not where the message is. To explain that better, after the sms loads if they were to just start typing they would be adding another person to send the message to, not typing the message. For example if I would like to load up to a specific row on my UIPicker on startup I would:

[picker selectRow:3 inComponent:0 animated:NO];

sms load up:

- (IBAction)sms {
    MFMessageComposeViewController *textComposer = [[MFMessageComposeViewController alloc] init];
    [textComposer setMessageComposeDelegate:self];
    if ([MFMessageComposeViewController canSendText]) {
        [textComposer setRecipients:[NSArray arrayWithObjects: @"support@nicmacengineering.com", nil]];
        [textComposer setBody:@""];
        [self presentViewController:textComposer animated:YES completion:NULL];
    } else {
        NSLog(@"Can't Open Text");
    }
}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
    switch (result) {
        case MessageComposeResultCancelled:
            NSLog(@"Cancelled");
            break;
        case MessageComposeResultFailed:
            break;
        case MessageComposeResultSent:
            break;
        default:
            break;
    }
    [self dismissViewControllerAnimated:YES completion:NULL];
}
Was it helpful?

Solution

First, your question is fairly hard to understand. Here's my impression of it:

Can I set the cursor to the message field by default in an SMS controller?

And the answer is:

No.

Since it is an Apple framework, with no public method to switch fields (here's the class reference).

Because of this, you won't be able to automatically set the position of the cursor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top