How can i show Keyboard while open Mailcomposer? - iphone

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.

Related

Retrieve the text entered by user in SLComposeViewController

I was wondering if theres a way to retrieve the complete text entered by the user in SLComposeViewController. I intend to fetch this value once SLComposeViewControllerCompletionHandler is returned to be True, and pass it as a parameter to Reply Twitter API.
Cheers!!
Officially, you can only "setInitialText:" and can not retrieve the text when the user is done entering it.
If the text were available as a property, then yes you could make use of it when the completion handler is called; but Apple has chosen not to make it available and therefore it's not currently possible through the official API's.
If this is something you need, I'd recommend filing a bug / enhancement request with Apple to ask them to consider it.
Now, all that said, I see that SLComposeViewController does inherit from UIViewController which means you can look at all the subviews of the view owned by the view controller. If you enumerate the subviews, look for the ones that are UITextViews or UITextField and there's where you should be able to find your text.

Is there an existing iOS component to type in a UITextView? [duplicate]

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

Making a UIWebView accessible

Simple question.
I have a UIWebView. It displays plain html text with a few headers. I want VoiceOver to read the content of this web view.
It would also be nice if I could make use of VoiceOver's rotor to let the user scroll through content using headers, but I won't get greedy yet.
Any input is appreciated.
What I have learned: If the view that the UIWebView is contained in is marked as accessibility enabled then voiceover will not pass through to the UIWebView.
UIWebView should be accessible with VoiceOver without you doing anything.
read this one :
http://arstechnica.com/apple/guides/2010/02/iphone-voiceservices-looking-under-the-hood.ars/
From the iOS developer documentation for accessibility.
A user interface element is accessible if it reports itself as an accessibility element. Although being accessible is not enough to make a user interface element useful to VoiceOver users, it represents the first step in the process of making your application accessible.
You can do something like this (or manually set a label):
[_view setIsAccessibilityElement:YES];
There is a lot of information here. I suggest that you consult this.
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/

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.

Is there an iPhone equivalent to the NSTokenField control?

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".
This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.
How is this done? Is it something that's provided in the UIKit or available somewhere else?
Many thanks,
Michael
Venmo just open sourced their token field.
https://github.com/venmo/VENTokenField.git
edited:
The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.
Since iOS 13 there exists UISearchTextField.
https://developer.apple.com/documentation/uikit/uisearchtextfield
You can see that component in action in the Photos App.
That should fit for many use cases. By removing the leftView you can also get rid of the search icon.
But be aware: You can‘t mix text and tokens at various positions.
From the docs:
Tokens always occur contiguously before any text in the search field.
Adding this here for reference:
Feel free to check out TaggerKit (a library I made), it's more or less what OP was talking about. You can basically add tags functionality to your app by just adding a view and a couple of properties.
I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement