'[ios] modalview MFMessageComposeViewController'에 해당되는 글 1건

  1. 2012.11.09 [ios] modalview MFMessageComposeViewController
  



#import <MessageUI/MessageUI.h>

#import <MessageUI/MFMessageComposeViewController.h>


MFMessageComposeViewControllerDelegate


MFMessageComposeViewController *controller = [[[MFMessageComposeViewController allocinitautorelease];

    if([MFMessageComposeViewController canSendText])

    {

        controller.body = @"Hello from Mugunth";

        controller.recipients = [NSArray arrayWithObjects:@"12345678"@"87654321"nil];

        controller.messageComposeDelegate = self;

        [self presentModalViewController:controller animated:YES];

    }




- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {

SMS.hidden = NO;

switch (result)

{

case MessageComposeResultCancelled:

SMS.text = @"Result: canceled";

NSLog(@"Result: canceled");

break;

case MessageComposeResultSent:

SMS.text = @"Result: sent";

NSLog(@"Result: sent");

break;

case MessageComposeResultFailed:

SMS.text = @"Result: failed";

NSLog(@"Result: failed");

break;

default:

SMS.text = @"Result: not sent";

NSLog(@"Result: not sent");

break;

}

[self dismissModalViewControllerAnimated:YES];

}

Posted by 예배하는 프로그래머