Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3693150
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:20:38+00:00 2026-05-19T04:20:38+00:00

When a button is pressed, the MFMailComposeViewController is presented. That far I have done.

  • 0

When a button is pressed, the MFMailComposeViewController is presented.

That far I have done.

My question is:

  1. Is it possible to disable the action sheet popping up when the cancel button is pressed?
  2. Is it possible to make the to and subject fields non-editable?
  3. I wanna change the left bar button to back.

How can I do these?

- (IBAction)questionButtonPressed:(id)sender {
    email = [[MFMailComposeViewController alloc] init];
    email.mailComposeDelegate = self;

    // Subject
    [email setSubject:@"Testing"];

    // Optional Attachments
    NSData *artwork = UIImagePNGRepresentation([UIImage imageNamed:@"albumart.png"]);
    [email addAttachmentData:artwork mimeType:@"image/png" fileName:@"albumart.png"];

    // Body
    //[email setMessageBody:@"This is the body"];

    // Present it
    [self presentModalViewController:email animated:YES];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:20:38+00:00Added an answer on May 19, 2026 at 4:20 am

    Yes All Three are possible, however #2 would either require using a private API or some hackery.
    I took the approach of subclassing MFMailComposeViewController as below

    // file: CustomMailComposeViewController.h
    @interface CustomMailComposeViewController : MFMailComposeViewController {
    
    }
    @end
    
    // file ustomMailComposeViewController.m
    #import "CustomMailComposeViewController.h"
    @implementation CustomMailComposeViewController
    
    -(void)viewWillAppear:(BOOL)animated {
      [super viewWillAppear:animated];
    
      //Here we replace the cancel button with a back button (Question #3)
      UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonPressed:)];
      self.navigationBar.topItem.leftBarButtonItem  = backButton;
      [backButton release];
    
    
      //Here we disallow the user to change to to: cc: bcc: and subject: feilds (Question #2)
      //Warning: the xxxField methods are undocumented private methods. 
      UITableViewController *vc = [self.viewControllers objectAtIndex:0];
      UITableView *tvv = [vc view];
      [[tvv toField] setUserInteractionEnabled:NO];
      [[tvv ccField] setUserInteractionEnabled:NO];
      [[tvv bccField] setUserInteractionEnabled:NO];
      [[tvv multiField] setUserInteractionEnabled:NO];
      [[tvv subjectField] setUserInteractionEnabled:NO];
    }
    
    
    //This is the target for the back button, to immeditally dismiss the VC without an action sheet (#1)
    -(void) backButtonPressed:(id)sender {
      [self dismissModalViewControllerAnimated:YES]; 
    }
    @end
    

    To use in your code you would change: [[MFMailComposeViewController alloc] init]; to [[CustomMailComposeViewController alloc] init];

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button that I would like to disable when the form submits
If i have a button pressed method like this: $('#next').click(function () { }); How
I'm developing a question game and I want to change the answer button pressed
I am trying to set a ViewState-variable when a button is pressed, but it
Here is the scenario: ThickBox is opened from parent window (when button is pressed)
I have a form with a few buttons which execute code when pressed like
Image a Button on your windows form that does something when being clicked. The
or How to simulate a home button pressed event? I need to restart my
How do I catch all links and button pressed? Without having to add my
Here's what currently happens in my app: Locking: iPhone Lock Button Pressed -> Audio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.