Hey Chris, I’m using the UITextView in my app and I’m struggling to keep the cursor above the keyboard as I’m editing my text view. Is there an easy way to fix this because I can’t see what I’m typing in the app as the keyboard does not keep up with my typing? I’m sorry if this is confusing but it would be great if you could give me a hand!
An example of this is in the apple notes app, no matter how many times you enter a new line, the cursor will always be above the keyboard. Hopefully, that helps you visualize it!
Hey, thanks for responding, I was thinking of another way to work around this issue. For example, could there be a way to raise the UITextView when the keyboard is present by changing the constraints programmatically? I noticed that if I changed the UI to make the textView be above the keyboard no matter what, when the text reached the end of the textView it looked fine. However, if I do this, the UI of my app doesn’t look very appealing. So I was wondering if there could be a way to update the constraints of the UITextView when the keyboard opens and then change them again when the keyboard goes away? Thanks!
I think it would work perfectly if I am able to programmatically change the bottom vertical constraint of my stackview when the keyboard opens. Would you have any idea on how to do this?
It should work if I can somehow just change the stack view vertical constraint; Bottom Space to Superview equals to ___ and change that value programmatically. But I’m not too sure how to do this aha
I’m not sure how to do that on my computer but basically, I have this screen that contains a basic UIView which is in red, and inside is a UITextView which has the following constraints in relation to the UIView. I was wondering if it would be possible for me to find a way to programmatically adjust the bottom constraint which I have highlighted so that when I activate the keyboard the constraint value will increase and then when I deactivate the keyboard the constraint will go back to what it originally was. I have already set up the texViewDidBeginEditing functions.
So I was thinking I could implement code in these functions using the NSLayoutConstraint. However, I do not really know how these work. (PS. the stack_view and tile_view are just temp names I have made when I linked the UIView and the UITextView to my swift file as @IBOutlet weak variables.)
But this doesn’t seem to change anything when I run the program and I think it has something to do with the fact I haven’t initialized the items correctly in the NSLayoutConstraint. If you have any idea on how I could potentially fix this so the constraints do update it should work! Hope this makes any sense
yes, it is defined in the storyboard. I actually managed to get this to work by updating the constraint when I activate the keyboard using the NSLayoutConstraint. However, now my issue is that when I deactivate the keyboard, it will change the constraint by deactivating/activating the constraint and I’m not sure why as it worked to make the constraint when the view loads and also when I activate the keyboard.
I managed to get it to work perfectly. Thanks for the help anyway! I’m still getting used to learning Swift and it’s great to see there is a helpful community that is happy to help newbies like me learn!