I have a weird behaviour that has only shown up in the last week. I don't use IB, all the controls are created in code.
I have a text field with a keyboard active. The first time I load the text field and use the keyboard, everything works normally. The second time I use it, the typed text does not show in the text field. However, the text is in the text field programmatically. For example, I can use it to execute a search. When the keyboard closes, the text appears.
Some of my UITextFields have misaligned text. For example, I write "hello", and instead of displaying centered inside the field like normal, it displays shifted several pixels downward to the extent that the bottom of the text is cut off. It's almost as if another view is chopping the bottom off the text by obscuring it.
I use three20, but according to http://groups.google.com/group/three20/browse_thread/thread/d7c4bc1ee2f9590d#, Xcode is suspected of causing the problem. I seen the behavior on 2 diferent macs, one running with Snow Leopard (10.6) and the other with Leopard (10.5).
This is how the problem looks in Xcode:
It is not obvious, but there is text in that search field. Notice that the placeholder text is not show. However, if I hit Search
, the code executes with the entered text.
This is how the app appears in the simulator:
I finally find the reason.
I call [textField becomeFirstResponder]
in a function called from loadView
. But I move it to viewDidAppear
and everything work Ok...