Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
464 views
in Technique[技术] by (71.8m points)

iphone - How to customize MFMailComposeViewController so that i can make the "to" field as non-editable?

I am using MFMailComposeViewController for sending feedback in my app. It works fine. But the problem here is, the user can edit/delete the "to" address. I want to make it as a non-editable one. May be, the user can add some mail addresses in "to" field.

But he/she should not delete the feedback address (Here, it is "[email protected]").

Here is my code...

MFMailComposeViewController *composeWindow = [[MFMailComposeViewController alloc] init];
composeWindow.mailComposeDelegate = self;

NSString *str = @"Subject of the feedback";
[composeWindow setSubject:[str stringByAppendingString:[[UIDevice currentDevice]systemVersion]]];

NSArray *toRecipients = [NSArray arrayWithObject: @"[email protected]"]; 
[composeWindow setToRecipients:toRecipients];

[self presentModalViewController:composeWindow animated:YES];
[composeWindow release];

Thanks in Advance

Rajkanth

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can not customize MFMailComposeViewController to avoid editing. Apple forbids this, and the reason is quite simple: it is the user and not you that must decide exactly what to send, to whom etc. The same applies for the UI controller allowing to send SMS (text) messages. And, of course, Apple does not allows sending an email or SMS without explicit interaction with the user. It is the user that must validate and send the email or SMS message. The validation process include the ability to cancel the message or to change any single property at will, including the "to" recipients.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...