Position of Text in SwiftUI keeps changing when its text is updated - ios

I am using Text to create a floating label for TextField but when user the value of Text is updated , it changes its position vertically and due to which other elements gets disturbed too.
Please have a look at the package.
https://github.com/maxakash/FloatingLabelTextField

Related

CosmicMind Material TextField : Adjust TextField position when it becomes first responder

I have a view and I have two Material Textfields in it. The problem is when I have to show detail Message or when the I click on text field the placeholder moves up. So if the space between fields is less then the animated placeholder text gets overlapped with above text field.
So far I have kept enough space between fields to rid of this issue but it does not look good moreover, in Android when the user clicks on the textfield and its animated text shows the textfield automatically moves some points down or up to cater the inner spacing issue.
Default View with

Jenkins text not auto-wrapping (causes text field stretching)

The text fields for some of the jobs have stretched beyond the screen bounds. It's still possible to see the text but scrolling is required (annoying).
The effect happens when only one of the text fields contains text that exceeds the normal screen bounds.
Instead of wrapping to the next line, the text keeps going and takes the screen bounds with it.
These screenshots show what's going on:
Is there some sort of configuration that I need to do to make this useable?
The Jenkins version is 1.635

iOS UITextView content offset and bounds origion change after changing text programmatically

I have a UITextView. The text in the view keeps changing based on user action. On many occasions, the text is too large to fit and so my text view (which has a desired fixed width and height) scrolls the text. The control flow is something like this
1) user takes some action, and text view appears with some text (possibly more than what can fit, so comes with a scroll)
2) user dismisses the view (I simply hide the text view)
3) user takes another action, and text view appears with new text (i use UITextView setText to reassign the text, and simply turn the hidden property to NO)
My text cannot be edited by the user. It is always reset to a different string in code
Problem:
When the textview is redrawn/rendered with the new text, on some occassions the contentoffset.y AND bounds.origin.y values of the text view are set to something besides 0, which is not desirable. It is intermittent, but creates a major UI issue. At least I think those new values are what causes the UI to look so weird. Open to other suggestions here...
I want to know why this happens, and how to fix this? Since the text is changed programatically, I can't depend on textViewDidChange: to reset these values.
EDIT: This is how I am changingt he text everytime something new has to be placed in the textview
[textView1 setText:someNSString];
where someNSString is, well, some string with text

Method to display UILabels and UIButtons Inline with each Other

In my app I have a "summary" paragraph that based on data an user actions in the app changes what it displays. The issue is it displays both regular text and clickable text (like a button) in the same sentence and line. The app will have a series of if else statements and based on the results of these the text that will be displayed is determined, but how do you make some of the text a button tied to an action and some of the text a plain label? Any and all help is appreciated!
In iOS 7, buttons look like blue text. I would suggest taking advantage of that fact.
I would use AutoLayout, and create your fields with constraints that put a very small amount of space between each label and button in your line of text/labels, with a vertical constraint on all of them that aligns their leading to match.

how to implement the autoresizing UITextView vertically?

First look at the screenshot:
second press the return button, the screenshot for your reference:
after four times click
return
button, the height of text field will not be higher any more.
now here is the question: how can I implement the function of textfield? and what about the background Image behind the text Field , should auto resize too? if there are any solution, let me know! thanks very much----
Make it UITextView not a text field, track the text changes at shouldChangeTextInRange of the textView delegate.
In this method calculate the number of lines (textView.contentSize.height/textView.font.lineHeight), compare it with the previous value to decide whether you need to proceed or just return. If the number of lines is changed, check whether the textView is already displaying the maximum number of lines (that must be 3 on the image) and based on the results you will change the textView, it's superview and a button frames (you can also make it animated easily) and probably scroll the text to the change region with scrollRangeToVisible.

Resources