Class: MFMailComposeViewController

Inherits:
UINavigationController show all

Overview

The MFMailComposeViewController class provides a standard interface that manages the editing and sending an email message. You can use this view controller to display a standard email view inside your application and populate the fields of that view with initial values, such as the subject, email recipients, body text, and attachments. The user can edit the initial contents you specify and choose to send the email or cancel the operation.

Instance Attribute Summary (collapse)

Attributes inherited from UINavigationController

#delegate, #navigationBar, #navigationBarHidden, #toolbar, #toolbarHidden, #topViewController, #viewControllers, #visibleViewController

Attributes inherited from UIViewController

#childViewControllers, #contentSizeForViewInPopover, #definesPresentationContext, #editing, #hidesBottomBarWhenPushed, #interfaceOrientation, #modalInPopover, #modalPresentationStyle, #modalTransitionStyle, #navigationController, #navigationItem, #nibBundle, #nibName, #parentViewController, #presentedViewController, #presentingViewController, #providesPresentationContextTransitionStyle, #restorationClass, #restorationIdentifier, #searchDisplayController, #splitViewController, #storyboard, #tabBarController, #tabBarItem, #title, #toolbarItems, #view, #wantsFullScreenLayout

Attributes inherited from UIResponder

#inputAccessoryView, #inputView, #undoManager

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from UINavigationController

#initWithNavigationBarClass:toolbarClass:, #initWithRootViewController:, #popToRootViewControllerAnimated:, #popToViewController:animated:, #popViewControllerAnimated:, #pushViewController:animated:, #setNavigationBarHidden:animated:, #setToolbarHidden:animated:, #setViewControllers:animated:

Methods inherited from UIViewController

#addChildViewController:, attemptRotationToDeviceOrientation, #beginAppearanceTransition:animated:, #canPerformUnwindSegueAction:fromViewController:withSender:, #decodeRestorableStateWithCoder:, #didMoveToParentViewController:, #didReceiveMemoryWarning, #didRotateFromInterfaceOrientation:, #disablesAutomaticKeyboardDismissal, #dismissViewControllerAnimated:completion:, #editButtonItem, #encodeRestorableStateWithCoder:, #endAppearanceTransition, #initWithNibName:bundle:, #isBeingDismissed, #isBeingPresented, #isMovingFromParentViewController, #isMovingToParentViewController, #isViewLoaded, #loadView, #performSegueWithIdentifier:sender:, #preferredInterfaceOrientationForPresentation, #prepareForSegue:sender:, #presentViewController:animated:completion:, #removeFromParentViewController, #rotatingFooterView, #rotatingHeaderView, #segueForUnwindingToViewController:fromViewController:identifier:, #setEditing:animated:, #setToolbarItems:animated:, #shouldAutomaticallyForwardAppearanceMethods, #shouldAutomaticallyForwardRotationMethods, #shouldAutorotate, #shouldPerformSegueWithIdentifier:sender:, #supportedInterfaceOrientations, #transitionFromViewController:toViewController:duration:options:animations:completion:, #updateViewConstraints, #viewControllerForUnwindSegueAction:fromViewController:withSender:, #viewDidAppear:, #viewDidDisappear:, #viewDidLayoutSubviews, #viewDidLoad, #viewWillAppear:, #viewWillDisappear:, #viewWillLayoutSubviews, #willAnimateRotationToInterfaceOrientation:duration:, #willMoveToParentViewController:, #willRotateToInterfaceOrientation:duration:

Methods inherited from UIResponder

#becomeFirstResponder, #canBecomeFirstResponder, #canPerformAction:withSender:, #canResignFirstResponder, #isFirstResponder, #motionBegan:withEvent:, #motionCancelled:withEvent:, #motionEnded:withEvent:, #nextResponder, #reloadInputViews, #remoteControlReceivedWithEvent:, #resignFirstResponder, #touchesBegan:withEvent:, #touchesCancelled:withEvent:, #touchesEnded:withEvent:, #touchesMoved:withEvent:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (Object) mailComposeDelegate

The mail composition view controller’s delegate. The delegate object is responsible for dismissing the view presented by this view controller at the appropriate time. Therefore, you should always provide a delegate and that object should implement the methods of the MFMailComposeViewControllerDelegate protocol.

Returns:

Class Method Details

+ (Boolean) canSendMail

Returns a Boolean indicating whether the current device is able to send email. You should call this method before attempting to display the mail composition interface. If it returns NO, you must not display the mail composition interface.

Returns:

  • (Boolean)

    YES if the device is configured for sending email or NO if it is not.

Instance Method Details

- (Object) addAttachmentData(attachment, mimeType:mimeType, fileName:filename)

Adds the specified data as an attachment to the message. This method attaches the specified data after the message body but before the user’s signature. You may attach multiple files (using different file names) but must do so prior to displaying the mail composition interface. Do not call this method after presenting the interface to the user.

Parameters:

  • attachment (NSData)

    The data to attach. Typically, this is the contents of a file that you want to include. This parameter must not be nil.

  • mimeType (String)

    The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see www.iana.org/assignments/media-types/. This parameter must not be nil.

  • filename (String)

    The preferred filename to associate with the data. This is the default name applied to the file when it is transferred to its destination. Any path separator (/) characters in the filename are converted to underscore (_) characters prior to transmission. This parameter must not be nil.

Returns:

- (Object) setBccRecipients(bccRecipients)

Sets the initial recipients to include in the email’s “Bcc” field. This method replaces the previous blind carbon-copy recipients with the new ones listed in the bccRecipients parameter. This method does not filter out duplicate email addresses, so if duplicates are present, multiple copies of the email message may be sent to the same address.You should call this method before you display the mail composition interface only. Do not call it after presenting the interface to the user.

Parameters:

  • bccRecipients (Array)

    An array of NSString objects, each of which contains the email address of a single recipient.

Returns:

- (Object) setCcRecipients(ccRecipients)

Sets the initial recipients to include in the email’s “Cc” field. This method replaces the previous carbon-copy recipients with the new ones listed in the ccRecipients parameter. This method does not filter out duplicate email addresses, so if duplicates are present, multiple copies of the email message may be sent to the same address.You should call this method before you display the mail composition interface only. Do not call it after presenting the interface to the user.

Parameters:

  • ccRecipients (Array)

    An array of NSString objects, each of which contains the email address of a single recipient.

Returns:

- (Object) setMessageBody(body, isHTML:isHTML)

Sets the initial body text to include in the email. This method replaces the previous body content with the new content. If the user has a signature file, the body content is inserted immediately before the signature. If you want to include images with your content, you must attach the images separately using the addAttachmentData:mimeType:fileName: method.You should call this method before you display the mail composition interface only. Do not call it after presenting the interface to the user.

Parameters:

  • body (String)

    The initial body text of the message. The text is interpreted as either plain text or HTML depending on the value of the isHTML parameter.

  • isHTML (Boolean)

    Specify YES if the body parameter contains HTML content or specify NO if it contains plain text.

Returns:

- (Object) setSubject(subject)

Sets the initial text for the subject line of the email. This method replaces the previous subject text with the new text. You should call this method before you display the mail composition interface only. Do not call it after presenting the interface to the user.

Parameters:

  • subject (String)

    The text to display in the subject line.

Returns:

- (Object) setToRecipients(toRecipients)

Sets the initial recipients to include in the email’s “To” field. This method replaces the previous recipients with the new ones listed in the toRecipients parameter. This method does not filter out duplicate email addresses, so if duplicates are present, multiple copies of the email message may be sent to the same address.You should call this method before you display the mail composition interface only. Do not call it after presenting the interface to the user.

Parameters:

  • toRecipients (Array)

    An array of NSString objects, each of which contains the email address of a single recipient.

Returns: