MFMailComposeViewController subject changes? - iphone

i am using apple's MFmailcomposer.in that when i type subject, the title of MFMailcomposer
is also changing, how can i avoid it?

This is default behavior for the Class. If you want to change it, you should write your own mail controller, or check out the one in Three20. The class you want to start with is TTMessageConposer. You should be able to pick it apart to achieve what you desire.

Related

Iphone SDK, switch keyboard in app

I have one question, may be it is very simple, but I do not know about this nothing...
For example, I have an application, application with textfield, I want to know two things.
First: Is possible to switch keyboard when application in runtime?
Second: how I can switch type of keyboard(Russian, English, Swedish, etc.) in my application*?
*-without going to Settings->General->Keyboard->add new keyboard.
Not sure about changing languages (I did find this other post about it: change input source language programmatically OSx), but changing the keyboard is pretty easy. Here is a one line example:
textField.keyboardType = UIKeyboardTypeURL;
Take a look at the UITextInputTraits protocol reference for more info. Then the question comes in where to implement this. I am assuming that you want to check conditions right before the keyboard comes up, you may have to implement UITextFieldDelegate protocol (and maybe using the field's tag to see which field the cursor is in).
Hope this helps.

Trying to message a button from another class

I'm new to Objective-C so I may be doing this completely wrong, and if I am please correct me. I am trying to make a separate class in my iPhone app just for skinning buttons. My hope is that this will allow me to reuse as much code as possible but before I spend too much time on it, I would like to know if its possible/a good idea to send a message to a UI Control from another class, and if i can, how should I do it? right now im trying to pass the sender ID to my SkinTools class and message that but it doesn't look like it will allow me to message the layer object.
So, am I just completely off the wall here, or is this possible?
Consider looking into using the delegate pattern.
One could just use the addTarget:selector: method for this purpose. As target set the class you want to send the message to, as selector the method you want to call on the class.
You could add some iVars to your class, like id buttonTarget and SEL buttonSelector and create an initializer like -initButtonWithTarget:selector: to set these values on initialization.
It turns out categories was the answer I needed, then I can just add a skin method to each control I use. I can even put them all in the same file to make it easy to get to.

How can i show Keyboard while open Mailcomposer?

I want to show keyboard when mail composer open without take any action.i mean when mail composer open automatically keyboard should display.
This isn't possible as far as I know. You might be able to traverse the views of the mailComposer to find the appropriate text field but that is a risky thing to do and liable to break.
Plus it might get your app rejected. Although it's not exactly clear. From the MFMailComposeViewController Class Reference:
Important: The mail composition interface itself is not customizable and must not be modified by your application. In addition, after presenting the interface, your application is not allowed to make further changes to the email content. The user may still edit the content using the interface, but programmatic changes are ignored. Thus, you must set the values of content fields before presenting the interface.

uiswitch default text change

I am trying to use a UISwitch controller but set its default text to "Yes/No" instead of "On/off". What is the easiest way to do that? Well is it doable?
Unfortunately in german language, but the source code is readable and it works well:
http://www.mobile-dev.de/iphone-code-schnipsel/34-iphone-user-interface/192-aendern-des-textes-von-uiswitch-elementen.html
But you should read the documentation:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UISwitch_Class/Reference/Reference.html
The UISwitch class is not customizable.
I do not know if it is allowed and you will get trouble in the Apple approval process.

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.