0

I've an image and text view. Text view is pinned to the bottom, left and right to superview. On iPhone 11 text view visible as intended but on iPhone 5S it is hidden. On iPhone 5S I've to scroll up to see text view which is not what I want. I want text view to be visible at the bottom on all devices as it's pinned to bottom of superview. I can't figure out what is wrong. Below are screenshots of IB and device screenshots.

How to fix this issue?

Device screenshots

Storyboard

Raymond
  • 1,108
  • 13
  • 32
  • I fixed it by a combination of solutions suggested on https://stackoverflow.com/questions/25693130/move-textfield-when-keyboard-appears-swift – Raymond Nov 16 '19 at 00:34

1 Answers1

1

If you want it to be visible regardless of the screen size, don't put it inside of the scrollview, put it outside. Right now it's constrained to its parent, which happens to be a view constrained to the scrollview, so it's positioned below, and you need to scroll to see it.

Renzo Tissoni
  • 642
  • 9
  • 21
  • Text view's parent is the inner view and not scroll view. – Raymond Nov 15 '19 at 18:03
  • Are you sure about that? From what I see in the image you attached the only textview is inside the scrollview. Try dragging it outside in the view tree and see what happens. Also, even if there's an intermediate parent, the scrollview is still a parent, so the view is effectively inside the scrollview. – Renzo Tissoni Nov 15 '19 at 18:08
  • Please see the image again https://i.stack.imgur.com/HYzeI.png I've image view and text view inside a view which is inside scroll view => View [ Scroll View [ Image view, Text View ] ] – Raymond Nov 15 '19 at 18:11
  • I insist, try to move it outside the scrollview. What you are doing now is scrolling a view that has a TextView inside. This won't achieve what you want as the TextView is **still** inside the ScrollView. Something like this => View [ TextView, ScrollView [ ImageView ] ] – Renzo Tissoni Nov 15 '19 at 18:15
  • 1
    Thank you, I understand what you are saying. I'll try it. – Raymond Nov 15 '19 at 18:33
  • If the answer helped you, remember to mark it as answered! – Renzo Tissoni Nov 15 '19 at 21:02
  • Something weird is going on in my actual project. I've removed scroll view all together, I don't think I need it. I've only Image view and Text view. Now on keyboard show the text view goes below keyboard on latest devices (simulator iPhone 11), On iPhone 5S it works. Is it something to do with how the view is presented? Does that affect? – Raymond Nov 15 '19 at 23:47