FloatingLabel Text Filed place holder animation issues while using JVFloatLabeledTextField - ios

I wanted a floating label text filed with underline or baseline for one of my iOS apps. I found that I can achieve that by making use of JVFloatLabeledTextField. So I drag & dropped some text fields to my storyboard and assigned JVFloatLabeledTextField as a class(custom) to those fields so that these text fields will be of type JVFloatLabeledTextField.
ISSUE1
In the below image the first part is what is showed after running the app. The issue here is when I start typing text in any of the textFields the place holder should animate upward but in my case the place holder is not showed/disappears as shown in the 2nd part of below image.When we tap on any other textField then the previously used textField palce holder is showed as shown in 3rd part of below image.
ISSUE2
keepBaseline = true, I have given this property to get the underline/baseline for the textFields, which I'm not getting.
I'm keeping all these text Fields in a stack view, will that cause any issue?
Programatically I haven't written any code for this.
Find the image here

Related

Accessibility: focus on a view

In my application (that has to be accessible for blind user) I have this scenario (its a grammatic exercise)
When I try it on a device turning on VoiceOver, first it focus on the first part of the sentence, so in that case it read "Kesha" and when i swipe right to read the next part it read the second part of the sentence "the contract because...". What I want is to make it also focus on the gray box (that is a UIViewelement) before it read the second part of the sentence, so that the user know where that empty box is in the sentence, but i don't know how to do that.
I alread tried grayBox.accessibilityLabel = "empty box" or grayBox.accessibilityHint = "empty box" but it just don't set the focus on that view and it doesn't speak. I also tried to put an empty UILabel inside the box but I have some issue positioning that in the right order and I don't think it is the right way to do it. Any suggestion?
On the UIView that you want to 'receive focus' you just need to enable accessibility or mark it as an accessible element, An example:
myGreyView.isAccessibilityElement = true
myGreyView.accessibilityLabel = "A grey box"
myGreyView.accessibilityHint = "this is a secretive box. I don't know what it does"
You can also tick a box in the UIView's properties in xcode interface builder "Accessibility Enabled" I think its called. Which also lets you set the label and hint.
For more information see this Apple guide to VoiceOver
In regards to the order of elements being read out. Is the first part and second part different UILabels or one label?
Are you adding these in code or Xib/Storyboard? Depending on the order they are added as subviews can effect the order VoiceOver reads items out.
When adding the 3x UI elements add them in this order below.
UILabel - "Kesha"
UIView - Gray box, "A grey box"
UILabel - "the contract because it was not fair."
If you have added them via Interface builder (Xib/Storyboard) make sure the order is correct in the view hierarchy.
If this fails you could try overriding the method "accessibilityElements" and return an array of the labels and grey view in the order you want them read out.

Set the Storyboard guide title to a #IBInspectable value for a custom #IBDesignable view in swift?

I have a custom #IBDesignable UIButton. I use several of them on a screen in the Storyboard file and they are central to the whole flow of the app. They all appear in the Guide as "Button":
"Button"s in guide
Seeing the actual title would be a whole lot easier in managing the Storyboard (although of course has no effect on actual runtime). I'd like to set the title to an #IBInspectable label text I'm using:
Their attribute Inspector
I'm using my own label text instead of the regular button title because it's layout and format is special. If I set the button title it shows up in the middle over the real title.
Ideally I want to set the guide "title" to my label. I couldn't find anything anywhere on how to do this. Otherwise, is there some work around trick to use the Button Label? Keep in mind this is just to make the Storyboard less confusing for others to see and use.
Thanks!
You can always slow double click each button (in the Document Outline (the left pane (your first picture))). It'll let you rename it right there.
By "slow double click" I mean, click to select, wait a sec, click again (without moving the mouse).
I'm only familiar with The Document Outline automatically naming things when you provide referencing outlets (control dragging to a .swift file). They'll take on the names of the variables you're dragging them to (even so far as formatting camel case with spaces and caps for you). Otherwise, in your case, you're probably going to have to manually name each one.
You can "name" your elements by filling in the Label field in the Identity Inspector pane:
As you see, I have a normal UIButton, and I put "Button One" in the Label field... so it shows up as "Button One" in the outline pane.

UI Testing Multiple UITextFields

I'm trying to create a UITest using the recording function for an app that contains multiple UITextFields per view. When trying to do so I'm having a couple issues.
To simplify the issue I have created an application with two text fields nested inside one subview as shown in the picture.
From here I opened the identity inspector and changed the label of the two UITextFields under the accessibility heading to 'topField' and 'bottomField' (accessibility disabled on the gray UIView). Then I went into the UITest 'testExample' function and click the record button. From here I click the top text field, type something in, then when I click the bottom text field I get this error 'Timestamped Event Matching Error: Failed to find matching element'.
What am I missing here? I know this is a result of Xcode not being able to find the text field in the hierarchy, but I don't know why since I have given labels to each element in accessibility. I am able to manually write the code into the testing method to access the second text field without any errors, but the recording is not working. Any help is greatly appreciated.

iOS - How can I hide text inputs without leaving gaps?

I am creating a form in my iOS app in which certain text fields need to be hidden depending on the number that was entered in the previous field. For example if 1 is entered there will be one field, if 4 is entered there will be four fields etc. all the way up to 25. I understand how to hide the buttons depending on number...the problem is when I hide the buttons they still leave the white space because all the fields are set up to position at x and y height. I have tried to put the inputs into a table view because I thought it would allow me to hide each table view cell containing the input and then move the rest up. But XCode gives me an error saying I can't connect IBOutlet to repeating content. Positioning the x and y height in the code won't work either because I need to do this a few times and there would be too many variables.
I have looked for a solution everywhere and haven't been able to find a solution. Does any one know how to hide text fields and make everything else below move up?
You could use autolayout by anchor each textfield to the one above.
Or you could give a tag to each textfield and then iterate with a cycle for till the index of your previous view to setHidden:false to the textfields

Text input pop-up for adding to tableview

I have a table view list and an add button at the top right. The user would press the button and a text field would pop up for a user to enter a string to be the label of the new item. Nothing new or special, what you'd expect from a "new playlist" type situation.
I am looking to have the small text field input that the user would type into. Most examples have the app move to a new view controller with a text field. I simply want a little box to overlay the current view that accepts a string. I cannot find/remember the name of the text box so I cannot find examples or code.
I think you are searching for something like
https://github.com/bmancini55/iOSExamples-DockedKeyboardView
Where your UITextField would be attached on the keyboard's accessory view.
OR
http://nshipster.com/uialertcontroller/
Where you use an UIALertController with an input field. I think the second one will resolve your problem more than the first one, because you are asking for a pop-up solution.
Hope it helps

Resources