title: Cancel Button is not working in sms integration for iPhone
body: <p>I am very new to implement delegate methods. I am implementing  sms application. I am able to open the sms delegate method and seen the TO and Send options but when I try to came back to main it is not working my code is as follows, please help me.</p>
  
  <pre><code>- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
  message.hidden = NO;
  switch (result)
    {
      case MessageComposeResultCancelled:
          message.text = @"Result: canceled";
          NSLog(@"Result: canceled");
          break;
      case MessageComposeResultSent:
          message.text = @"Result: sent";
          NSLog(@"Result: sent");
          break;
      case MessageComposeResultFailed:
          message.text = @"Result: failed";
          NSLog(@"Result: failed");
          break;
      default:
          message.text = @"Result: not sent";
          NSLog(@"Result: not sent");
          break;
     }
  
  [self dismissModalViewControllerAnimated:YES];
  
   }
  </code></pre>