I'd like the iPhone virtual keyboard to appear pre-set to a particular language (Russian for example) when the user taps a UITextField. Is there a way to do this in Cocoa code?
This is a user defined setting and can not be messed with by the programmer, unfortunately.
Not sure why you'd want to do this -- I don't speak Russian, and I'd be a little alarmed if all of the sudden a Russian keyboard appeared.
The user can choose which language they want in their iPhone Settings app. That then determines which keyboard appears when they tap a text field.
I want to do this because I am writing a language learning application.
What makes the current keyboard selection setup on the iPhone even worse (at least for me) is that it doesn't remember the keyboard for each appliaction. So that if you change it for one app it remains the same keyboard for the next app you open.
I don't know about iPhone 3.0 SDK, but as of 2.x, you can't control this. What you can do, however, is make a custom keyboard. It's a lot more work, but you could remake the layouts for each language.
I need the same. I need to set a nickname by users, but do not want to let them set different except in English. How to do that?
UPD: UIKeyboardTypeASCIICapable does not do the work. I have Russian keyboard and it shows first always.
In answer to the the question about English keyboard - Apple did design for that - you can use the ASCII keyboard - which you can choose with: UIKeyboardTypeASCIICapable.
There is no problem in 3.1+. I set this for 3.0:
self.searchBar.keyboardType = UIKeyboardTypeURL;
and language switch button is appeared.