Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • MFMessageCompose ViewController in swift

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 723
    Comment on it

    Step1: Import the MessageUI using :- import MessageUI

    Step 2: class ViewController: UIViewController, MFMessageComposeViewControllerDelegate

    Step 3: when you tap on the button the list of contact will appear and you can choose the contact from the list

    @IBAction func btnShowContactClicked(sender:UIButton)
            {
            println("btn clicked")
                var messageVC = MFMessageComposeViewController()
                messageVC.body = "Enter a message";
                messageVC.recipients = ["Enter tel-nr"]
                messageVC.messageComposeDelegate = self;
    
                self.presentViewController(messageVC, animated: false, completion: nil)
            }
    
            func messageComposeViewController(controller: MFMessageComposeViewController!, didFinishWithResult result: MessageComposeResult) {
                switch (result.value) {
                case MessageComposeResultCancelled.value:
                    println("Message was cancelled")
                    self.dismissViewControllerAnimated(true, completion: nil)
                case MessageComposeResultFailed.value:
                    println("Message failed")
                    self.dismissViewControllerAnimated(true, completion: nil)
                case MessageComposeResultSent.value:
                    println("Message was sent")
                    self.dismissViewControllerAnimated(true, completion: nil)
                default:
                    break;
                }
            }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: