MFMailComposeViewController and cancelling "save" action sheet? - iphone

i am using MFMailComposeViewController inside my iphone app. I notice that if i enter any text in the body and then press the cancel button, i am prompted with an action sheet with an option to save/don't save the unsent message. I have two questions:
can I programmatically prevent the "save/don't save action sheet from appearing? MFMailComposeViewControllerDelegate doesn't appear to have anything along those lines
if i do save, where is the mail saved to? i looked in my mail accounts and didn't see anything saved in any of the "draft" folders.

No, you can't avoid the action sheet appearing. It's been added in iOS 4.x to, precisely, avoid tapping on the "Cancel" button inadvertently when writing a long email, which I think it's a good idea.
It is saved in "Drafts" folder of the account used to compose the e-mail (normally, your "default account" as it is registered in the Settings of your device). I've just tried using a couple of apps and it works.

Related

Prevent users from typing and clicking in MS Word Add-in

I am writting a MS Word Add-in, I create a button to run a long time work with text. My work requires that during the time it is excuted, no change can be made by user ( typing, clicking, deleting ...) When this work is completed, user can type and click as usual.
I have used
this.Application.Options.AllowClickAndTypeMouse = false;
However, this doesn't work.
Who can help me!
First, your approach is wrong. The Click and Type is Word functionality and has nothing to do with disabling user Mouse clicks
(For more information about Click and Type refer to here).
Now for your question, here is one approach I would suggest:
If the user is not able to do any action, I would expect an appropriate message, so my idea is to create a modal form by using:
myForm.ShowDialog();
It should do the job and block the active document until it get closed.
I would also add a nice progress bar and "Close" button which you will enable when work has done.

How to send sms, detecting text in textview?

I want that when user clicks on certain text,(like call, sms, mail), then corresponding activity should happen ie, when user clicks on call then an action sheet should appear with actions whether you want to save or call etc, similarly for sms and mail.I used textview and gave detection for numbers and email. So for call and mail it is working fine. But how to detect for sms?Because when I give number detection it will automatically show call action sheet ie save or call or cancel.But I want following action sheet, which sms, open, copy, cancel:
I tried using sms//"91123456", but it is not working. I know I can directly launch message picker but do not want this, I want to show default action sheet.I tried this in html and it is working but I want to do in native.
Did you try textView.dataDetectorTypes = UIDataDetectorTypeAll;?
For more data detector types see this UIKit Data Types Reference.

Can ABNewPersonViewController be used to edit existing records?

I'm trying to use ABNewPersonViewController to edit an existing record.
I set the displayedPerson property and it shows up fine with all the info.
If I hit Save, everything works as expected. However, if I hit Cancel, the record is deleted from the Address Book.
The only solution I can think it is deep copying the record and then re-adding it to the Address Book if the user cancels out of the editing dialog. Is there really no better way?
add a custom "Cancel" button to replace the original "cancel" button of ABNewPersonViewController!!

MFMailComposeViewController attachment choice

I'm using a MFMailComposeViewController in my iphone app and I'd like to give the user the choice to attach some pictures to the e-mail.
As there is no specific button by default, I was thinking about subclassing MFMailComposeViewController and adding a button for this. Unfortunately, according to the documentation the addAttachmentData: method shouldn't be called once the view has been displayed, so the choice can not be made during the mail composition.
I also thought about creating my own mail composer view, but according to this question: Send mail without MFMailComposeViewController , Apple does not want developers to do this as this could be used to abuse the user's mail account.
So, it seems the only solution is to ask the user prior to showing up MFMailCompose, and the only way for the user to change his choice would be to cancel mail composition and start it again, am I right?
When user tap the attach button, dismiss the MFMailComposeViewController and open the image picking controller. When the image is picked, create a new MFMailComposeViewController with the previous content and the new image as attachment.
I have not tried this. You can give a try.
Self answer: for me, the simplest way was to add a UIAlertView asking the user wether he wants to add the images or not, prior to showing up the mail composer view.
This is adequate as all images should be sent together (so it's all or none), but for more elaborate cases (chose some images from the iphone for example), Anil Sivadas' answer might be a solution.

Need new way to add a UITextField to a UIAlertView

So my app was rejected (it has been approved every other time i have put it in for review and I hadn't touched this code path in ages) or this line:
[myAlert addTextFieldWithValue:nil label:NSLocalizedString(#"Name",#"Name")];
Apparently addTextFieldWithValue:label:
is a private API...
so how are we supposed to put a UITextField inside an AlertView?
Can someone help?
Consider using a modal view controller, instead. No risk of app rejection.
You don't. Alert views are for displaying alerts only. Apple uses them to display text fields sometimes, but that's their prerogative (since they wrote the HI guidelines and all).
Find a different approach in your UI for prompting the user for data. This is a mobile platform, not a desktop. Using popups like this for information gathering on such a platform is usually inappropriate.