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

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

Related

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

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

How to move my chat input bar up on top with keyboard in Xcode?

I create a chat program. I've created my chat sequence using TableView. Now I have a view on the bottom of the page, contains one TextField and a send button. Now if I press on the TextField, the keyboard appears. I need to:
reduce the height of the tableView so that I still can see the most recent chat message, and return it to its former height if the keyboard is hidden.
move the view up to sit on top of the keyboard, and return it to its former position if the keyboard is hidden.
do both of things above with animation.
I'm still newbie in this keyboard + animation area. I only know I will need to implement textFieldDidBeginEditing and textFieldDidEndEditing to do this. But I don't know what code I should implement inside it. This answer provided some, but not the exact answer to my problem (it only moves the floating TextField in the scrollable view of TableView to be within the visible area, not moving a view not related with TableView). Any help or even article will be appreciated. Thanks!

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

Scroll back to top in iOS UITextView after change of text

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 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)
Problem Scenario:
Perform step 1 above, user scroll down a little to read the content, then proceeds with step 2 and 3. But when the text view reappears, the view is still scrolled a little from the last interaction. I want the text to be visible from the start, meaning, the scroll shud be "reset"
What I tried:
[textView scrollRangeToVisible:NSMakeRange(0,0)]; //OR
[textView scrollRangeToVisible:NSMakeRange(0,600)]; //600 being an approximate number of characters that can show in my text view after which they flow out and it has to be scrolled.
this was the most successful attempt. Worked most of the time, except, sometimes, intermittently, there would be a lot of extra space on top of my line 1 of the text, like someone scrolled/swiped it down and froze it there.
PS:My text cannot be edited by the user. It is always reset to a different string in code

iOS: Stop ScrollView from making room when selecting textfield at top

I've scoured through several questions asking about how to prevent scrolling when selecting a first responder however nothing I find seems to work for this issue.
I have a UITextField above my table view at the very top of my page. When the user selects it (or when I do it programmatically) it drops down a bit, seemingly giving room for options such as "paste" or autocorrect (which I've disabled). I'd like to prevent this from happening.
I've tried setting the scroll position myself, which it initially does, but then it instantly jumps down a bit. Is there a way I can make the paste/edit bubble appear below the textfield (like it does with textfields in the header)? I'm thinking perhaps that will prevent it from jumping downwards, but I can't find information on this.
I'm completely stuck so any help is appreciated. Links, vague suggestions, whatever. Thank you.
Try embedding your text field in a scroll view the same size as your text field.
The reason why this should work is because when a text field becomes first responder, it only scrolls the scroll view that is its most recent ancestor in the view hierarchy. If it only finds the dummy scroll view, whose content size should not exceed its bounds size, then no scrolling should occur in either scroll view.

Resources