Editing UITextField in tvOS shows a new view where the user can enter in text, and when text entry is done, the user is returned to the previous view. However, I have found that when I return from the text editor, the text I edit does not show up in my text fields. What's going on?
tvOS version 9.1
The reason why it isn't working is because the UITextField is using a non-default background color. Apparently in tvOS, the background color is rendered to the layer after the text has been rendered (Interestingly enough, this does not affect placeholder text). This also happens in interface builder. A bug report has been sent to Apple.
I had a similar issue with shared iOS/tvOS code where the next textfield placeholder text disappeared and became unresponsive.
Make sure that you are NOT setting textField.endEditing(true)
Related
I am currently working on tvOS app and I am stuck at subclassing textfields. I normally subclass textfields on iOS without problem, somehow tvOS is different.
Here are the bugs that are happening:
textColor is white, after pressing and typing textColor is black
attributed placeholder is white, after typing text, text is black and after clearing text, placeholder appears black and centered horizontally
secure text entry enlarges font
and another random bugs appear and overall textfield is buggy
(It happens even if subclass is very basic - like changed text color after init or in setup method etc.)
Do you have any idea how to fix it or working solution of textfield subclass on tvOS? Thanks
i'm facing a really strange problem: i have some UILabel in my view, which has a black background, so i set their text color to white in Interface Builder in order to see them, the problem is, when i run the app on the simulator or on my iphone with ios7 or iOS 6.1.3 i can update them without problems (for update i mean: myLabel.text = #"Something")
but when i run the app on my sister's iphone 3gs with iOS 6.0 at the moment i update them the font color turns black. It seems that on her phone the label can't remember the color set on IB.
Does anyone of you know why this happens?
Thanks
It sounds like you have set the label "type" to "Attributed" in Interface Builder.
If this is the case then it is not the label that holds the text colour. It is the text itself.
If you replace the text with something else then the default text color of black will be used.
If you want to continue using Attributed text then you need to add a "foregroundColor" attribute to the text before setting it to the label.
The easier way round this is to change the label type to "Plain" in Interface Builder.
Of course, this depends on you having set it to Attributed.
I think you shouldn't use default label color in the interface builder, just provide something else (black color or etc.).
I ran into a similar problem. Was stumping me completely, until I quit and relaunched the simulator. It wasn't enough to just close the window or rebuild. I had to cmd-q, then build and launch again. Magically fixed the issue. Annoying.. but worked for me
In my app, I have modified the UILabel and made it underline the text if the phone number or email appears.
but I want to highlight the text when the phone number or email is touched as shown below (I want something like what has been shown below by the dark gray highlight in background of the text "http://www.foodreporter.net".
I want to do this without use of CoreText as my app targets from iOS 3.1.2 onwards. So I don't want to use the CoreText and Attributed strings.
I want to subclass the UILabel and do it somehow. How can it be done?
I don't have the option to use OHAttributedLabel and TTTAttributedLabel.
I suggest for a workaround. What you can do is, use custom UIButton instead of label. Set the default and highlighted image of the button according to your need.(Simple text for default, and highlighted text for highlighted).
Happy Programming
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...
I've seen that happen with text fields and affine transforms. If you rotate a text field using a transform, the text shows up in a seemingly random part of the superview. If you use a transform to move the text field to make room for the keyboard, you might be seperating the embedded text editor from the field itself. That would also explain why the text is in the code because the text attribute of the text field is not affected by the visual layout of the UI.
My text view shows the text when i am using iphone OS 3.0-
but for some reason it will not show the text on OS 2.0.
I can get the inputed text on OS 2.0 and even save it to file,
and then restore the text but still- the text is not visible on OS 2.0.
I have tried changing the scrolling properties and the font and the color and the hidden property -
Anybody have an idea what it is?
Thanks-
Nir.
Answering my own question:
I added my text view to a button view-
so i changed it and now I am adding it to a uiView.
I guess there is a different way for displaying a text field on top of a button in the old OS 2.0.